- Home /
Question by
Pong · Aug 16, 2011 at 08:10 AM ·
animationresolutionguitextureresize
how to size the guitexture which with animation on it in different resolutions?
I have a gui texture that with an animation on it. When I am using iphone device, it is fine. On andriod, as there is so many resolution size. So I want to resize the gui texture automatically. but the animation is having a problem after resize. How can I fix it?
Comment
Answer by BAIZOR · Nov 03, 2013 at 01:34 PM
Hello! I am thinking you can create curve via script, and change GUITexture scale. For example:
float fromX = 0, toX = 1, fromY = 0, toY = 1.2f, animationDuration = 1;
// duration is in seconds
AnimationCurve curveX = AnimationCurve.Linear(0, fromX, animationDuration, toX);
AnimationCurve curveY = AnimationCurve.Linear(0, fromY, animationDuration, toY);
AnimationClip clip = new AnimationClip();
clip.name = "Resize";
clip.SetCurve("", typeof(Transform), "localScale.x", curveX);
clip.SetCurve("", typeof(Transform), "localScale.y", curveY);
animation.AddClip(clip, clip.name);
animation.Play(clip.name);
More info you may find here
Your answer
Follow this Question
Related Questions
gui texture crop and resize 1 Answer
Scale Animation 1 Answer
Scale menu to fit webplayer with fullscreen on/off 0 Answers
gui texture different scale in full screen game. 1 Answer
Cutting off a GUITexture's texture 0 Answers