x


Gliding a GUI Element in...

Does Lerp work for OnGUI to glide a GUI element into view?

more ▼

asked Apr 30 '11 at 05:43 AM

ina gravatar image

ina
3.3k 492 547 596

(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

To make things even easier you could use the animation engine LeanTween and accomplish this with very little code:

public var grumpy:Texture2D;
private var grumpyRect:LTRect;

function Start () {
    grumpyRect = new LTRect( -grumpy.width, 0.5*Screen.height - grumpy.height/2.0, grumpy.width, grumpy.height ); 

    // Slide in
    LeanTween.move(grumpyRect, new Vector2(0.5*Screen.width - grumpy.width/2.0, grumpyRect.rect.y ), 1.0, {"ease":LeanTween.easeOutQuad});
}

function OnGUI(){
    GUI.DrawTexture( grumpyRect.rect, grumpy);
}

There are more advanced examples here.

more ▼

answered Apr 23 at 12:33 PM

dentedpixel gravatar image

dentedpixel
141 2

(comments are locked)
10|3000 characters needed characters left

Here's a Unity thread about Lerping a GUI element .. compliments of Google: Animating GUI movement?

more ▼

answered Apr 30 '11 at 05:59 AM

GlennHeckman gravatar image

GlennHeckman
335 7 10 19

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3668
x261
x242
x9
x5

asked: Apr 30 '11 at 05:43 AM

Seen: 1083 times

Last Updated: Apr 23 at 12:33 PM