chefkeifer Posted January 10, 2010 Share Posted January 10, 2010 can you apply this to an image and/or text import com.greensock.*; import com.greensock.easing.*; import flash.geom.Matrix; import flash.display.*; var colors:Object = {left:0xB8E46F, right:0x0066CC}; TweenMax.to(colors, 3, {hexColors:{left:0xff9900, right:0x663399}, onUpdate:drawGradient}); var mySprite:Sprite = new Sprite(); addChild(mySprite); drawGradient(); function drawGradient():void { var m:Matrix = new Matrix(); m.createGradientBox(220, 220, 0, 0, 0); mySprite.graphics.beginGradientFill(GradientType.LINEAR, [colors.left, colors.right], [1, 1], [0x00, 0xFF], m, SpreadMethod.PAD); mySprite.graphics.drawRect(0,0,220,220); } Link to comment Share on other sites More sharing options...
GreenSock Posted January 11, 2010 Share Posted January 11, 2010 Are you saying you want to apply a gradient to text or an image? You could use a mask I suppose, yes. Or BitmapData, but it'd be more complex. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now