2D Toolkit Forum
2D Toolkit => Support => Topic started by: JBabz on October 16, 2013, 05:29:42 pm
-
Does anybody know specifically how to tween the color of a tk2dSprite using iTween?
There is a method called colorTo(), but that only changes the color of a texture or GUITexture.
Is there a way? Seems like it's pretty easy, and I'm just missing something.
Thanks!!
-
You can use iTween.ValueTo to do this... it's a little verbose, though.
void startTheTween()
{
iTween.ValueTo(yourSprite.gameObject, iTween.Hash(
"time", 0.6f,
"from", new Color(0, 0, 0, 1),
"to", new Color(1, 1, 1, 1),
"onupdate", "setSpriteColor",
"onupdatetarget", this.gameObject,
));
}
void setSpriteColor(Color c)
{
yourSprite.color = c;
}
-
That works great!
Thanks.