Package | com.greensock.plugins |
Class | public class HexColorsPlugin |
Inheritance | HexColorsPlugin ![]() ![]() |
0xFF0000
) over the
course of 2 seconds, you'd do:
TweenMax.to(myObject, 2, {hexColors:{myHexColor:0xFF0000}});
You can pass in any number of properties.
USAGE:
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. TweenLite.to(myObject, 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}; TweenLite.to(myColor, 2, {hexColors:{hex:0x0000FF}, onUpdate:applyColor}); function applyColor() { mc.graphics.clear(); mc.graphics.beginFill(myColor.hex, 1); mc.graphics.drawRect(0, 0, 100, 100); mc.graphics.endFill(); }
Copyright 2008-2013, GreenSock. All rights reserved. This work is subject to the terms in http://www.greensock.com/terms_of_use.html or for Club GreenSock members, the software agreement that was issued with the membership.