Animations
Overview
Maverick AI animations are command-driven from the client and executed on-board by the glasses render engine.
Main building blocks:
M2Animator- one animator instance per drawable + animation typeAnimatorType- what property is animatedAnimatorRepeat- repeat behavior (None,Repeat,RepeatBack)IM2AnimatorCallback- started/stopped/failed eventsM2AnimationsChain- sequence/parallel orchestration
How animations work on board
- App creates drawables and adds them to screen/panel.
- App configures an animator with the target property, duration, and repeat mode.
- App starts animator (
anim.start()). - SDK sends animator create/params commands once to glasses.
- Glasses OS advances animation every render tick on-device.
- App receives callbacks; app may stop/restart/change other objects.
This avoids per-frame animation streaming from phone and keeps motion smooth even when transport bandwidth is limited.
Animation families (AnimatorType)
- Position/size:
X,Y,Width,Height - Opacity/color:
Alpha,Red,Green,Blue - Shape params:
RadiusX,RadiusY,A0(arc start angle),A1(arc end angle),PenSize - Text/sprite:
ScaleFont,Sprite - Matrix transforms:
MatrixScale,MatrixDx,MatrixDy,MatrixDz,MatrixRx,MatrixRy,MatrixRz - LOS / AR world movement:
WorldVecX,WorldVecY,WorldVecZ - Gradient params:
GradAlpha,GradRed,GradGreen,GradBlue,GradSize,GradAngle
Start, stop, repeat, callback
Start
Most public usage is:
- Build animator through extension function (sets params/callback)
- Call
start()
val anim = rect.translateXBy(
durationMillis = 600,
dx = 120f,
repeat = AnimatorRepeat.None,
apply = true,
callback = object : IM2AnimatorCallback {
override fun animatorStarted(animator: M2Animator) {}
override fun animatorStopped(animator: M2Animator) {}
override fun animatorFailed(animator: M2Animator, err: String) {}
}
)
anim.start()
Stop
For repeating animations you can request graceful stop (finish current cycle first):
Repeat modes
AnimatorRepeat.None: run once to targetAnimatorRepeat.Repeat: loop from start to targetAnimatorRepeat.RepeatBack: ping-pong (forward/back)
Common usage examples
Position animation
val move = card.translateYBy(500, dy = -40f, repeat = AnimatorRepeat.None, apply = true)
move.start()
Size animation
LOS / AR movement
Sequence and parallel orchestration
M2AnimationsChain()
.then { rect.translateXBy(300, 40f, apply = true) }
.with { rect.translateYBy(300, 20f, apply = true) } // runs in parallel in same step
.then { rect.translateXBy(300, -40f, apply = true) }
.start()
Alpha Release
The current alpha release includes a subset of the animation types and helpers. Additional animation capabilities will be added in future releases.
Important behavior notes
- A drawable keeps one animator per
AnimatorType; requesting same type returns/reuses that animator. apply = truemeans final value is force-applied to drawable state when animation stops.- Matrix animators auto-ensure matrix exists before creation (so transform animators can run safely).
See Also
- Transformations - 2D and 3D matrix transforms
- Rendering Pipeline - How frames are drawn on the display
- Custom Controls - Build reusable composite drawables