GreenSock


ColorTransformProxy - Advanced Color Tweening

Posted in Tweening by jack on the April 15th, 2008


Version 1.1, Updated 4/15/2008

  • Compatibility: Flash Player 8 and later (AS2 and AS3 versions)
  • File Size added to published SWF: About 1Kb

Get this class free when you join Club GreenSock

DESCRIPTION

Tweening a MovieClip's/DisplayObject's tint is already a built-in feature of TweenLite/TweenMax. But what if you want to tween more advanced color-related properties? Ever wanted to tween advanced effects like bleaching or flashing? If you tried, you probably noticed that it didn't work unless you kept re-applying a freshly edited colorTransform object to your MovieClip on every frame. Annoying, I know. And did you ever want to tween the percent of tint that a MovieClip gets? Me too. Well this class gives you an easy way to set/tween various ColorTransform properties. You can use it with almost any tweening engine, but of course it integrates perfectly with TweenLite/TweenFilterLite/TweenMax.

Get the AS2 and AS3 flavors of this class by joining Club GreenSock

PROPERTIES

  • tint
  • tintPercent
  • brightness
  • redOffset
  • greenOffset
  • blueOffset
  • alphaOffset
  • redMultiplier
  • greenMultiplier
  • blueMultiplier
  • alphaMultiplier
  • color (same as tint)

USAGE

Simply create a new ColorTransformProxy instance for any MovieClip/DisplayObject you'd like to control (like var ctp = new ColorTransformProxy(my_mc)). Then when you change the property of the ColorTransformProxy instance, it'll affect the MovieClip/DisplayObject. See the interactive demo above to see exactly how the code works. It's pretty simple actually.

Keep in mind that when you change a MovieClip's/DisplayObject's tint, you won't notice a change unless you also set the tintPercent to a value other than zero.

Already a Club GreenSock member and need the latest version?

Just e-mail questions@greensock.com and I'll send you a link.

Author: Jack Doyle, (e-mail: jack -at- greensock.com)
Copyright 2008, GreenSock (This work is subject to the terms here.)

Leave a Reply