Rotate elements around the X, Y, and Z axes.
Default: 0 degrees for all axes
When no start value is configured for any axis, the default will be used for that axis.
Type alias for the animation group name.
Set the initial X, Y, and Z rotation.
import Anim.Engine.* as Engine
import Anim.Property.Rotate as Rotate
init : ( Model, Cmd Msg )
init =
( { animState = Engine.init [ Rotate.initXYZ "animGroupName" 45 30 60 ] }
, Cmd.none
)Set the initial X and Y rotation.
import Anim.Engine.* as Engine
import Anim.Property.Rotate as Rotate
init : ( Model, Cmd Msg )
init =
( { animState = Engine.init [ Rotate.initXY "animGroupName" 45 30 ] }
, Cmd.none
)Set the initial X and Z rotation.
import Anim.Engine.* as Engine
import Anim.Property.Rotate as Rotate
init : ( Model, Cmd Msg )
init =
( { animState = Engine.init [ Rotate.initXZ "animGroupName" 45 60 ] }
, Cmd.none
)Set the initial X rotation.
import Anim.Engine.* as Engine
import Anim.Property.Rotate as Rotate
init : ( Model, Cmd Msg )
init =
( { animState = Engine.init [ Rotate.initX "animGroupName" 45 ] }
, Cmd.none
)Set the initial Y and Z rotation.
import Anim.Engine.* as Engine
import Anim.Property.Rotate as Rotate
init : ( Model, Cmd Msg )
init =
( { animState = Engine.init [ Rotate.initYZ "animGroupName" 30 60 ] }
, Cmd.none
)Set the initial Y rotation.
import Anim.Engine.* as Engine
import Anim.Property.Rotate as Rotate
init : ( Model, Cmd Msg )
init =
( { animState = Engine.init [ Rotate.initY "animGroupName" 30 ] }
, Cmd.none
)Set the initial Z rotation.
import Anim.Engine.* as Engine
import Anim.Property.Rotate as Rotate
init : ( Model, Cmd Msg )
init =
( { animState = Engine.init [ Rotate.initZ "animGroupName" 60 ] }
, Cmd.none
)Turn the AnimBuilder into a rotate animation Builder for the specified animation group.
Use this to start configuring a rotate animation.
myAnimation : AnimBuilder eng -> AnimBuilder eng
myAnimation =
Rotate.begin
>> ... -- Configure and build the animationComplete the Builder animation configuration and return an AnimBuilder
so you can continue configuring other property animations or execute the animation with an Engine.
myAnimation : AnimBuilder eng -> AnimBuilder eng
myAnimation =
Rotate.begin
>> ... -- configure the animation with from, to, duration, easing, etc.
>> Rotate.end
>> ... -- continue with animationSet the starting X, Y, and Z rotations (degrees).
myAnimation : AnimBuilder eng -> AnimBuilder eng
myAnimation =
Rotate.begin
>> Rotate.fromXYZ 45 90 180
>> ... -- continue with animationSet the starting X and Y rotations (degrees). Z is left unchanged (or 0 if not set).
Set the starting X and Z rotations (degrees). Y is left unchanged (or 0 if not set).
Set the starting X rotation (degrees). Y and Z are left unchanged (or 0 if not set).
Set the starting Y and Z rotations (degrees). X is left unchanged (or 0 if not set).
Set the starting Y rotation (degrees). X and Z are left unchanged (or 0 if not set).
Set the starting Z rotation (degrees). X and Y are left unchanged (or 0 if not set).
Set the target X, Y, and Z rotations (degrees).
myAnimation : AnimBuilder eng -> AnimBuilder eng
myAnimation =
Rotate.begin
>> Rotate.toXYZ 45 90 180
>> ... -- continue with animationSet the target X and Y rotations (degrees). Z is left unchanged (or 0 if not set).
Set the target X and Z rotations (degrees). Y is left unchanged (or 0 if not set).
Set the target X rotation (degrees). Y and Z are left unchanged (or 0 if not set).
Set the target Y and Z rotations (degrees). X is left unchanged (or 0 if not set).
Set the target Y rotation (degrees). X and Z are left unchanged (or 0 if not set).
Set the target Z rotation (degrees). X and Y are left unchanged (or 0 if not set).
Move by a delta instead of to a fixed rotation. The end
value is current + delta where current is the live animated rotation.
Only available on the Sub and WAAPI engines. Using these with any other engine results in a type error.
Move by a delta on the X, Y, and Z axes.
Move by a delta on the X and Y axes. Z is unaffected.
Move by a delta on the X and Z axes. Y is unaffected.
Move by a delta on the X axis. Y and Z are unaffected.
Move by a delta on the Y and Z axes. X is unaffected.
Move by a delta on the Y axis. X and Z are unaffected.
Move by a delta on the Z axis. X and Y are unaffected.
📖 See Animation Timing for details.
Set the delay (milliseconds) before the animation starts.
Set the animation duration (milliseconds).
The speed represents how many degrees the element rotates per second.
For example, a rotation animation from 0° to 180° with a speed of 90.0
will take 2 seconds to complete.
📖 See Easing for details.
Set the easing function for the animation.
import Motion.Easing exposing (Easing(..))
Rotate.easing EaseInOut📖 See Spring for details.
Drive this property with a spring.
import Motion.Spring as Spring
Rotate.spring Spring.wobblyKeep rotate values on each axis within a range you choose.
Values outside the range are clamped to the nearest boundary.
The range stays in effect for future animations until you Unclamp it:
update msg model =
case msg of
KnobTurned angle ->
let
( animState, cmd ) =
WAAPI.animate model.animState <|
Rotate.begin
>> Rotate.clampZ -90 90
>> Rotate.end
in
( { model | animState = animState }
, cmd
)Keep the X axis rotation within min and max values. If min > max the values are flipped.
Keep the Y axis rotation within min and max values. If min > max the values are flipped.
Keep the Z axis rotation within min and max values. If min > max the values are flipped.
Remove the X axis range for this animation group. Does nothing if no range is set.
Remove the Y axis range for this animation group. Does nothing if no range is set.
Remove the Z axis range for this animation group. Does nothing if no range is set.
Snap to a specific rotation, cancelling any in-flight animation on this property.
Snap to a uniform rotation on all three axes silently, cancelling any in-flight animation on this property.
Snap target X, Y and Z angles.
Snap target X and Y angles, preserving the current Z angle.
Snap target X and Z angles, preserving the current Y angle.
Snap target X angle, preserving the current Y and Z angles.
Snap target Y and Z angles, preserving the current X angle.
Snap target Y angle, preserving the current X and Z angles.
Snap target Z angle, preserving the current X and Y angles.
Builder type for rotate animations.