Jeremy Rudd Posted December 15, 2012 Share Posted December 15, 2012 Hi, What is the difference between TintPlugin and HexColorsPlugin? HexColors says it tweens colors so they "look correct", does tint plugin use a dumber version of the same? Thanks Link to comment Share on other sites More sharing options...
GreenSock Posted December 16, 2012 Share Posted December 16, 2012 The only difference is that the TintPlugin is only for applying a tint to a DisplayObject whereas HexColorsPlugin is for animating any color property of any object. The tint has to be applied in a very specific way to a MovieClip/Sprite, for example, because there is no "tint" property. The plugin does that work for you. But sometimes you might have some other object that has a color property that you want to tween and that's what HexColorsPlugin is for. var obj:Object = {myColor:0xFF0000}; TweenLite.to(obj, 2, {hexColors:{myColor:0x0000FF}, onUpdate:showColor}); function showColor():void { trace("obj.myColor is " + obj.myColor); } Does that clear things up? There is absolutely no difference in terms of hte 1 Link to comment Share on other sites More sharing options...
Jeremy Rudd Posted December 16, 2012 Author Share Posted December 16, 2012 Okay, so basically TintPlugin is HexColors + More (whatever is needed for tinting), correct? So I'm not missing out on anything if I use TintPlugin? Thanks for the quick replies, Jack. Link to comment Share on other sites More sharing options...
GreenSock Posted December 16, 2012 Share Posted December 16, 2012 I suppose you could think about it that way (although it's not quite that simple). If all you need to do is animate a MovieClip/Sprite/DisplayObject to a particular color, TintPlugin is indeed all you need. Yep. 1 Link to comment Share on other sites More sharing options...
Jeremy Rudd Posted December 17, 2012 Author Share Posted December 17, 2012 Okay, although regarding the "its not so simple" part, I've opened up Tint and HexColors and Tint doesn't seem to have the code that hex colors has. Unless ColorTransform takes care of that. It seems to be linearly tweening the color using updateTweens(). Although I trust what you say, from a code perspective I still don't see how they are similar. HexColors seems to tween each prop (RGB) seperately, but Tint seems to do it together. Am I missing something? I don't mind complicated explanations, if you have the time. Thanks again, Jack. Link to comment Share on other sites More sharing options...
GreenSock Posted December 17, 2012 Share Posted December 17, 2012 Yep, ColorTransform is just a layer of abstraction that does the same sort of thing but is necessary for applying tints to DisplayObjects in AS3. HexColorsPlugin is more of a raw tool that handles busting the red, blue, and green components of a hex color apart and tweening them separately and then re-combining them to form a hex color again before applying it. Under the hood they're doing exactly the same thing. Think of ColorTransform's redOffset, blueOffset, and greenOffset as being the red, blue, and green components of a hex color. The TintPlugin is tweening the ColorTransform instance's redOffset, blueOffset, and greenOffset whereas HexColorsPlugin is creating its own generic object with red, blue and green properties and tweening those. Make sense? 1 Link to comment Share on other sites More sharing options...
Jeremy Rudd Posted December 17, 2012 Author Share Posted December 17, 2012 Beautiful. Absolutely fantastic. Never thought of it that way. Thanks a ton, jack! You really are a support superhero. No kidding. 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