- Home /
Animate GUI Texture
How can I animate a GUI texture. Basicly I have a compass that has to rotate by looking at the gameObject by rotating in 2D.
Felipe
Answer by DaveA · Feb 11, 2012 at 12:15 AM
If it doesn't really have to be in a GUI texture, just in another layer, you could have it camera-facing, with its own camera on it (off in the distance somewhere) and have that camera's depth set higher than the main camera. Then the main camera will render the main scene first, then the compass camera will render the compass on top of that.
I could use this answer for a $$anonymous$$ini$$anonymous$$ap question
Answer by dentedpixel · May 04, 2013 at 12:22 PM
I have added some handy animation helpers to my animation engine LeanTween, that allow you to animate such elements like:
var textRect3:LTRect = new LTRect(0.0, 0.0, 200, 300 );
function OnGUI(){
if(GUI.Button(new LTRect(0.0, 0.0, 200, 300 ), "Rotate")){
LeanTween.rotate( textRect3, 150.0, 1.0, ["ease",LeanTween.easeOutElastic]);
}
GUI.DrawTexture( textRect3.rect, textureToAnimate);
GUI.matrix = Matrix4x4.identity; // Reset to normal rotation
}
Your answer
Follow this Question
Related Questions
How do I trigger GUI elements 1 Answer
simple gui question 2 Answers
Rotate slowly to target position? 3 Answers
How to enable the mouse cursor in some areas? 1 Answer
Rotate GUI button 0 Answers