1
Support / Re: Load images from url ?
« on: December 05, 2012, 04:55:07 pm »
i just trying to implement facebook friends avatars inside game.
any ideas, how i can do it ?
any ideas, how i can do it ?
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
using UnityEngine;
using System.Collections;
public class TintLoop : MonoBehaviour
{
public Color Color;
public float Duration;
void Start ()
{
tk2dSprite sprite = GetComponent<tk2dSprite>();
Hashtable options = new Hashtable();
options.Add("from", sprite.color);
options.Add("to", Color);
options.Add("time", Duration);
options.Add("OnUpdate", "updateSpriteColor");
options.Add("looptype", iTween.LoopType.pingPong);
options.Add("easetype", iTween.EaseType.linear);
iTween.ValueTo(gameObject, options);
}
void updateSpriteColor(Color color)
{
tk2dSprite sprite = GetComponent<tk2dSprite>();
sprite.color = color;
}
}
I know a lot of people like HOTween, but you should also check out GoKit by Prime31 http://forum.unity3d.com/threads/133823-Prime31-GoKit-Tween-Library-Live
I was using HOTween, but recently switched over to this and I have to say the performance on mobile devices is superior.
@camelot10.
The Unity animation system won't correctly animate tk2dSprite colors / spriteswitches. The reason for it is that Unity Animation system only animates member variables and not .net properties. I have a few different snippets of code I use when I need to do this. A bit more explanation on your needs and I could probably suggest what to do here.
As 39thstreet says, HOTween is excellent and works perfectly. If you're more comfortable with something like that then that will just work out of the box.