I'm trying to write an Applescript that would dim Philips Hue bulbs based on a quartic ease in/out (speed up until halfway point, then slow down towards the end). The script would run every 10 minutes and calculate what the brightness should be at that time, based on the quartic ease in/out. I've found the quartic ease in/out formula in other programming languages but unfortunately my attempts to convert it into Applescript have resulted in values that don't make sense. Since programming and Applescript aren't my strong suites I was hoping someone could help me sort this out. Here's what I have for the calculation: Code: set b to 0 as integer -- starting brightness set c to 255 as integer -- target brightness set t to 10 as integer -- elapsed time in minutes set d to 60 as integer -- fade duration in minutes t ≠ d / 2 if t < 1 then set hueBrightness to c / 2 * t * t * t * t + b as real else set t to t - 2 set hueBrightness to -c / 2 * (t * t * t * t - 2) + b as real end if In the sample script above 10 minutes would have passed since the fade began (t = 10).