Package org.polyfrost.polyui.operations
Class KeyFrames
-
- All Implemented Interfaces:
public final class KeyFrames<T extends Drawable> extends DrawableOp.Animatable<T>
Keyframes are an easy way to create animations on components. PolyUI uses a Kotlin DSL to create them in an easy and concise way.
They can be created wherever a Drawable is in scope, so everything from events for mouse clicks; to in your initialization block; using the extension function keyframed.
Each keyframe can be added using a number between 0 (representing the start or 0%) to 100, representing the end or 100%. Each keyframe can control the color, rotation, position, skew and size of the component (using this function). They support different animation curves and durations using the animation parameter.
The syntax is as follows:
keyframed(2.seconds, Animations.EaseOutExpo) { 20 { // at 20% or 0.4 seconds, the rotation will be 25 degrees rotation = 25.0 } 32.5 { // at 32.5%, the rotation will be 35 degrees rotation = 35.0 } 50 { rotation = 180.0 } 100 { // when it is finished, we will be fully rotated (equal to 0 degrees) rotation = 360.0 } }
-
-
Method Summary
Modifier and Type Method Description final Unitinvoke(Number $self, Function1<KeyFrame, Unit> frame)final Unitat(Float percent, Function1<KeyFrame, Unit> frame)final Unitframe(Float percent, Function1<KeyFrame, Unit> frame)final Unitbegin()-
Methods inherited from class org.polyfrost.polyui.operations.DrawableOp.Animatable
apply, finishNow, getOnFinish, reset, reverse, setOnFinish, unapply -
Methods inherited from class org.polyfrost.polyui.operations.DrawableOp
add, remove, verify -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-