YaSpinnerComponent¶
Beta
YaSpinnerComponent
determines whether an object spin and the way it spins.Functions¶
void Start()Beta
Starts the object spin.
void Stop()Beta
Stops the object spin.
Sets the target rotation axis.
float3 GetRotationAxis()Beta
Gets the target rotation axis.
number GetSpeed()Beta
Gets the spin speed.
void SetSpeed(number speed)Beta
Sets the spin speed.
void SetTargetAngle(number angle)Beta
Sets the target angle of the spin. The spin won't stop when the target is reached and the event
FinishEvent
is triggered.
angle
angle of rotation
number GetTargetAngle()Beta
Returns the target angle.
Events¶
StartEvent<void>Beta
Triggered when the spin starts.
PauseEvent<void>Beta
Triggered when the spin pauses.
FinishEvent<void>Beta
Triggered when the spin finishes.
Code sample¶
This following code sample makes the object spin in the specified speed, around the specified axis, to the specified angle.
-- Prepares the component.
local spinner = script:GetYaComponent("YaSpinnerComponent")
-- Sets the speed to 5.
spinner:SetSpeed(5)
-- Sets the target angel to 360 degrees.
spinner:SetTargetAngle(360)
-- Starts spinning.
spinner:Start()