2D Toolkit Forum
2D Toolkit => Support => Topic started by: Tongie on September 22, 2012, 09:38:43 am
-
can i make a animated sprite fade in and out in 2dtoolkit?
-
Yes, the easiest way to do this is probably with something like HOTween or GoKit.
Edit: Or you could just write a coroutine to do it.
-
I have to change the shader to transparent/diffuse and all the other texture become darker. Is there any other method to do a fade in?
-
You don't have to change the shader, just access use sprite.color property (color.a precisely). You can do that in the interface or from script.
-
I use itween.valueto and itween.fadeto on a animatedSprite but fail.
iTween.ValueTo(gameObject, iTween.Hash("from", 1.0f, "to", 0.0f,"time", 2.0f, "easetype", "easeInOutQuad", "onupdate", "setAlpha"));
iTween.FadeTo(gameObject, iTween.Hash("alpha", 0));
renderer.material.color = new Color(255,255,255,0);
none work.what am i doing wrong here?
-
I don't use iTween, but here is an example of modifying a textmesh using HOTween -
http://unikronsoftware.com/2dtoolkit/forum/index.php/topic,542.msg2555.html#msg2555
With a sprite, the only difference will be that the call to Commit isn't necessary.