FadeAnimation Edit

function FadeAnimation(object, toOpacity, duration, easeType[, doneFunction])
  • object - the object to fade (Frame, Window, Image, TextArea, text, ...)
  • toOpacity - the target opacity. The fade moves through opacities from the current value to this parameter
  • duration - duration of the fade in ms
  • easeType - the characteriztic of the easing, linear or non linear, etc. see Ease
  • doneFunction - optional function, called when the animation concluded (and if it is started with animator.start();
// called when fade has concluded
var fade_done = function() {
   print("this fade is complete);

// create fade animator
var fade_in = new FadeAnimation(myFrame, 255, 800, KEASE_IN, fade_done);

// start animator assynchroniously

Animations are start in two ways:

  • synchronously with animator.runUntilDone(...), which will not call the doneFunction and continue with the succeeding code after the fade has finished
  • asynchronously with animator.start(...). which will only start when the script returns to it's main loop. This also means that multiple animations can run at the same time, i.e. on image is faded out, while another image is faded in.

Issues Edit

  • The duration for the Animators are specified in milliseconds, while the duration of the simple Image.fade() function is specified as multiple of 100 milliseconds. You should consider Image.fade() to be deprecated and always use FadeAnimation instead.
  • In 3.0.2 you can't reuse a FadeAnimator, i.e. declare it in the onLoad section and call it every time a mouseExit occurs.