Classpublic class HexColorsPlugin
InheritanceHexColorsPlugin Inheritance TweenPlugin Inheritance Object

[AS3/AS2 only] Although hex colors are technically numbers, if you try to tween them conventionally, you'll notice that they don't tween smoothly. To tween them properly, the red, green, and blue components must be extracted and tweened independently. The HexColorsPlugin makes it easy. To tween a property of your object that's a hex color to another hex color, just pass a hexColors Object with properties named the same as your object's hex color properties. For example, if myObject has a "myHexColor" property that you'd like to tween to red (0xFF0000) over the course of 2 seconds, you'd do:, 2, {hexColors:{myHexColor:0xFF0000}});

You can pass in any number of properties.


import com.greensock.TweenLite; 
import com.greensock.plugins.TweenPlugin;
import com.greensock.plugins.HexColorsPlugin;
TweenPlugin.activate([HexColorsPlugin]); //activation is permanent in the SWF, so this line only needs to be run once., 2, {hexColors:{myProperty:0xFF0000}});

Or if you just want to tween a color and apply it somewhere on every frame, you could do:

var myColor:Object = {hex:0xFF0000};, 2, {hexColors:{hex:0x0000FF}, onUpdate:applyColor});
function applyColor() {;, 1);, 0, 100, 100);;

Copyright 2008-2013, GreenSock. All rights reserved. This work is subject to the terms in or for Club GreenSock members, the software agreement that was issued with the membership.

Public Methods
 MethodDefined By
[static] Activates one or more plugins so that TweenLite and TweenMax recognize the associated special properties.