• Studio

  • Bots

  • Web API

  • Designer Resources

  • Host Resources

  • API

    Datatypes

    Edit

    Tween

    Tween object for creating smooth animations and transitions. Tween objects are used to create smooth animations and transitions between values. They can be used to animate properties of objects, such as position, scale, rotation, and color. Tweens can be played, paused, stopped, and updated. They can also be delayed, looped, and ping-ponged. Easing functions can be applied to tweens to create different effects, such as acceleration and deceleration. Tweens can be created using the Tween.new method.

    Properties

    isPlaying

    boolean

    Indicates if the tween is currently playing. If the tween is playing, it is animating its properties.

    local tween = Tween.new()
    
    print(tween.isPlaying) -- false
    

    isPaused

    boolean

    Indicates if the tween is currently paused. If the tween is paused, it can be resumed by calling the Play method.

    local tween = Tween.new()
    
    print(tween.isPaused) -- false
    

    isValid

    boolean

    Indicates if the tween is valid and can be used. If the tween is not valid, it has been stopped or removed from the tween manager.

    local tween = Tween.new()
    
    print(tween.isValid) -- true
    

    time

    number

    Current time of the tween.

    local tween = Tween.new()
    
    print(tween.time) -- 0
    

    Current time of the tween normalized to the range [0, 1]. This value represents the progress of the tween animation.

    local tween = Tween.new()
    
    print(tween.normalizedTime) -- 0
    

    duration

    number

    Total duration of the tween. The tween will take this amount of time to complete.

    local tween = Tween.new()
    
    print(tween.duration) -- 1
    

    Checks if any tween is currently animating. Returns true if any tween is playing, and false if no tweens are playing.

    print(Tween.IsAnyTweenAnimating()) -- false
    

    Methods

    Plays the tween animation. If the tween is already playing, it will restart from the beginning.

    local tween = Tween.new()
    
    tween:Play()
    

    Returns

    Stops the tween animation. If the tween is set to destroy, deactivate, or disable on stop, it will be removed from the tween manager.

    local tween = Tween.new()
    
    tween:Stop()
    

    Parameters

    executeCallbacks

    boolean

    Returns

    void

    Pauses the tween animation. The tween can be resumed by calling the Play method.

    local tween = Tween.new()
    
    tween:Pause()
    

    Returns

    void

    Updates the tween animation for the given delta time. Returns true if the tween is still playing, and false if it has finished.

    local tween = Tween.new()
    
    tween:Update(0.1)
    

    Parameters

    deltaTime

    number

    Returns

    boolean

    Sets the priority of the tween. Higher priority tweens will be played before lower priority tweens.

    local tween = Tween.new()
    
    tween:Priority(1)
    

    Parameters

    priority

    number

    Returns

    Delays the start of the tween animation. The tween will not start until the delay time has passed.

    local tween = Tween.new()
    
    tween:Delay(1)
    

    Parameters

    seconds

    number

    Returns

    Adds additional delay to the tween animation. The tween will not start until the delay time has passed.

    local tween = Tween.new()
    
    tween:AddDelay(1)
    

    Parameters

    seconds

    number

    Returns

    Sets the duration of the tween animation. The tween will take this amount of time to complete.

    local tween = Tween.new()
    
    tween:Duration(2)
    

    Parameters

    seconds

    number

    Returns

    Sets the ID of the tween. The ID can be used to identify the tween in the tween manager.

    local tween = Tween.new()
    
    tween:Id(1)
    

    Parameters

    id

    number

    Returns

    Sets whether the tween should be destroyed when stopped. If true, the tween will be removed from the tween manager when stopped.

    local tween = Tween.new()
    
    tween:DestroyOnStop(true)
    

    Parameters

    value

    boolean

    Returns

    Sets whether the tween should be deactivated when stopped. If true, the tween will be deactivated when stopped.

    local tween = Tween.new()
    
    tween:DeactivateOnStop(true)
    

    Parameters

    value

    boolean

    Returns

    Sets whether the tween should be disabled when stopped. If true, the tween will be disabled when stopped.

    local tween = Tween.new()
    
    tween:DisableOnStop(true)
    

    Parameters

    value

    boolean

    Returns

    Sets whether the tween should automatically stop when finished. If true, the tween will stop automatically when it reaches the end of its duration.

    local tween = Tween.new()
    
    tween:AutoStop(true)
    

    Parameters

    value

    boolean

    Returns

    Creates a ping-pong effect for the tween animation. The tween will play forward and then backward.

    local tween = Tween.new()
    
    tween:PingPong()
    

    Returns

    Starts the tween animation from a specified point. The tween will start from the current value of the tween target.

    local tween = Tween.new()
    
    tween:From()
    

    Returns

    Loops the tween animation a specified number of times. If the count is set to -1, the tween will loop indefinitely.

    local tween = Tween.new()
    
    tween:Loop(2)
    

    Parameters

    count

    number

    Returns

    Sets whether the tween should use unscaled time for its animation. If true, the tween will not be affected by time scale.

    local tween = Tween.new()
    
    tween:UnscaledTime(true)
    

    Parameters

    unscaled

    boolean

    Returns

    Sets the element associated with the tween animation. The tween will animate the properties of the specified element.

    local tween = Tween.new()
    
    tween:Element(DataType.Tween)
    

    Parameters

    element
    Tween

    Returns

    Applies an ease-in quadratic easing function to the tween. This function accelerates the tween animation.

    local tween = Tween.new()
    
    tween:EaseInQuadratic()
    

    Returns

    Applies an ease-out quadratic easing function to the tween. This function decelerates the tween animation.

    local tween = Tween.new()
    
    tween:EaseOutQuadratic()
    

    Returns

    Applies an ease-in-out quadratic easing function to the tween. This function accelerates and decelerates the tween animation.

    local tween = Tween.new()
    
    tween:EaseInOutQuadratic()
    

    Returns

    Applies an ease-in cubic easing function to the tween. This function accelerates the tween animation.

    local tween = Tween.new()
    
    tween:EaseInCubic()
    

    Returns

    Applies an ease-out cubic easing function to the tween. This function decelerates the tween animation.

    local tween = Tween.new()
    
    tween:EaseOutCubic()
    

    Returns

    Applies an ease-in-out cubic easing function to the tween. This function accelerates and decelerates the tween animation.

    local tween = Tween.new()
    
    tween:EaseInOutCubic()
    

    Returns

    Applies an ease-in back easing function to the tween. This function overshoots the target value before settling into place.

    local tween = Tween.new()
    
    tween:EaseInBack()
    

    Parameters

    amplitude

    number

    Returns

    Applies an ease-out back easing function to the tween. This function overshoots the target value before settling into place.

    local tween = Tween.new()
    
    tween:EaseOutBack()
    

    Parameters

    amplitude

    number

    Returns

    Applies an ease-in-out back easing function to the tween. This function overshoots the target value before settling into place.

    local tween = Tween.new()
    
    tween:EaseInOutBack()
    

    Parameters

    amplitude

    number

    Returns

    Applies an ease-in elastic easing function to the tween. This function creates a spring-like effect.

    local tween = Tween.new()
    
    tween:EaseInElastic()
    

    Parameters

    oscillations

    number

    springiness

    number

    Returns

    Applies an ease-out elastic easing function to the tween. This function creates a spring-like effect.

    local tween = Tween.new()
    
    tween:EaseOutElastic()
    

    Parameters

    oscillations

    number

    springiness

    number

    Returns

    Applies an ease-in-out elastic easing function to the tween. This function creates a spring-like effect.

    local tween = Tween.new()
    
    tween:EaseInOutElastic()
    

    Parameters

    oscillations

    number

    springiness

    number

    Returns

    Applies an ease-in bounce easing function to the tween. This function creates a bouncing effect.

    local tween = Tween.new()
    
    tween:EaseInBounce()
    

    Parameters

    oscillations

    number

    springiness

    number

    Returns

    Applies an ease-out bounce easing function to the tween. This function creates a bouncing effect.

    local tween = Tween.new()
    
    tween:EaseOutBounce()
    

    Parameters

    oscillations

    number

    springiness

    number

    Returns

    Applies an ease-in-out bounce easing function to the tween. This function creates a bouncing effect.

    local tween = Tween.new()
    
    tween:EaseInOutBounce()
    

    Parameters

    oscillations

    number

    springiness

    number

    Returns

    Applies an ease-in sine easing function to the tween. This function accelerates the tween animation.

    local tween = Tween.new()
    
    tween:EaseInSine()
    

    Returns

    Applies an ease-out sine easing function to the tween. This function decelerates the tween animation.

    local tween = Tween.new()
    
    tween:EaseOutSine()
    

    Returns

    Applies an ease-in-out sine easing function to the tween. This function accelerates and decelerates the tween animation.

    local tween = Tween.new()
    
    tween:EaseInOutSine()
    

    Returns

    Applies an ease-in circular easing function to the tween. This function accelerates the tween animation.

    local tween = Tween.new()
    
    tween:EaseInCircle()
    

    Returns

    Applies an ease-out circular easing function to the tween. This function decelerates the tween animation.

    local tween = Tween.new()
    
    tween:EaseOutCircle()
    

    Returns

    Applies an ease-in-out circular easing function to the tween. This function accelerates and decelerates the tween animation.

    local tween = Tween.new()
    
    tween:EaseInOutCircle()
    

    Returns

    Applies an ease-in exponential easing function to the tween. This function accelerates the tween animation.

    local tween = Tween.new()
    
    tween:EaseInExponential()
    

    Parameters

    exponent

    number

    Returns

    Applies an ease-out exponential easing function to the tween. This function decelerates the tween animation.

    local tween = Tween.new()
    
    tween:EaseOutExponential()
    

    Parameters

    exponent

    number

    Returns

    Applies an ease-in-out exponential easing function to the tween. This function accelerates and decelerates the tween animation.

    local tween = Tween.new()
    
    tween:EaseInOutExponential()
    

    Parameters

    exponent

    number

    Returns

    Applies an ease-in cubic Bezier easing function to the tween. This function accelerates the tween animation.

    local tween = Tween.new()
    
    tween:EaseInCubicBezier()
    

    Parameters

    p0

    number

    p1

    number

    p2

    number

    p3

    number

    Returns

    Applies an ease-out cubic Bezier easing function to the tween. This function decelerates the tween animation.

    local tween = Tween.new()
    
    tween:EaseOutCubicBezier()
    

    Parameters

    p0

    number

    p1

    number

    p2

    number

    p3

    number

    Returns

    Applies an ease-in-out cubic Bezier easing function to the tween. This function accelerates and decelerates the tween animation.

    local tween = Tween.new()
    
    tween:EaseInOutCubicBezier()
    

    Parameters

    p0

    number

    p1

    number

    p2

    number

    p3

    number

    Returns

    Resets all tweens. This will stop all tweens and remove them from the tween manager.

    Tween.Reset()
    

    Returns

    void

    Stops all tweens. This will stop all tweens and remove them from the tween manager.

    Tween.StopAll()
    

    Parameters

    executeCallbacks

    boolean

    Returns

    void

    Updated about 2 months ago

    PocketWorlds Icon

    © 2024 Pocket Worlds. All rights reserved.