TweenPosition (Method): Difference between revisions

From Legacy Roblox Wiki
Jump to navigationJump to search
>Legend26
The last two args ARE important. Will write about them later.
>61352151511
No edit summary
Line 24: Line 24:
GUI:TweenPosition(UDim2.new(1, 0, 1, 0), "Out", "Quad", 3)
GUI:TweenPosition(UDim2.new(1, 0, 1, 0), "Out", "Quad", 3)
</pre>
</pre>
The override will allow you to start another tween while the first one is in progress. In order for this to happen, we have to set booloverride to true.
<pre>
GUI:TweenPosition(UDim2.new(1, 0, 0, 0), "Out", "Quad", 3, true)
wait(1.5)
GUI:TweenPosition(UDim2.new(0.5, 0, 1, 0), "Out", "Quad", 3, false)
</pre>
So in the above example it will Start tweening to the right side of the screen, but half way through it will start another tween and make it go to the bottom.


[[Category:Methods]]
[[Category:Methods]]

Revision as of 11:03, 13 August 2011

TweenPosition( UDim2 endPosition, Enum easingDirection = Out, Enum easingStyle = Quad, float time = 1, bool override = false, function callback = nil )
Returns nil
Description: Smoothly moves a GUI to a new UDim2 position.
Member of: GuiObject


The endPosition, is where the GUI moves to. For example if the GUI is at UDim2.new(0, 0, 0, 0) and you want it to move to UDim2.new(1, 0, 1, 0) it would be

GUI:TweenPosition(UDim2.new(1, 0, 1, 0))

The easingDirection, can be either. In, Out, or InOut. Most commonly it is Out.

GUI:TweenPosition(UDim2.new(1, 0, 1, 0), "Out")

The easingStyle could be 8 different items.

GUI:TweenPosition(UDim2.new(1, 0, 1, 0), "Out", "Quad")

The float is how long it will take it to move. 1 is the default. Let's make it take 3 seconds.

GUI:TweenPosition(UDim2.new(1, 0, 1, 0), "Out", "Quad", 3)

The override will allow you to start another tween while the first one is in progress. In order for this to happen, we have to set booloverride to true.

GUI:TweenPosition(UDim2.new(1, 0, 0, 0), "Out", "Quad", 3, true)
wait(1.5)
GUI:TweenPosition(UDim2.new(0.5, 0, 1, 0), "Out", "Quad", 3, false)

So in the above example it will Start tweening to the right side of the screen, but half way through it will start another tween and make it go to the bottom.