OnLoop

Constructor:

OnLoop(callback)

Description

Calls a method when the Tween animation starts the next loop.

Parameter

Variable name Class Name Description
callback fuction The function to call.

Examples

Use the following code. It can be added to a server or client script. The code is to create a part and an animation for the part to play. Play the animation after creating a Tweener object, and output a text when the animation starts a loop.

local part = RWObject.Create("Part")
part.Name = "RE"
part.Parent = WorkSpace
local tweenInfo = 
{
    duration = 3000, -- unit: ms
    repeatCount = 3, -- repeat times, -1 for no limit
    easing = "inSine", -- animation playing type
    yoyo = true, -- animation loop type
    delay = 1000 -- delay for repeated playing
}

local action = {
    Position = Vector3.New(20, 0, 20), 
    Rotation = Vector3.New(0, 90, 0), 
    Color = Vector3.New(0, 255, 0)
    }
local tween = TweenServiceJS:CreateTween(part, tweenInfo,action)
tween:OnLoop(function()
        print("Loop starts")
end)
tween:Play()