Classpublic class HexColorsPlugin
InheritanceHexColorsPlugin Inheritance TweenPlugin

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 hexColor 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:{myHexColor: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():void {;, 1);, 0, 100, 100);;

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

Public Properties
 PropertyDefined by
 InheritedchangeFactor : Number
Public Constants
 ConstantDefined by
 InheritedVERSION : Number = 1.32