SnapshotTransition

class SnapshotTransition(repository: EntityRepository, from: Snapshot, to: Snapshot, spec: AnimationSpec, onFinished: () -> Unit = {}) : Animatable

Plays the drawing in repository from the snapshot from to to: register it with the host's AnimationController and every tick sets the shapes to what Morph gives for how far along it is (the curve of spec decides how that moves). When it is over, repository holds exactly to and onFinished is called; a transition that has finished does nothing more, so the host can unregister it there.

It is a show, not an edit: nothing goes into the undo history. While it plays the shapes are not the ones the drawing engine's state refers to (a selected shape may be gone or under another id), so the host should leave the editing modes first, and not draw until it has finished.

Throws

if spec has no duration or repeats: a transition goes from one snapshot to the other once.

Constructors

Link copied to clipboard
constructor(repository: EntityRepository, from: Snapshot, to: Snapshot, spec: AnimationSpec, onFinished: () -> Unit = {})

Properties

Link copied to clipboard

Whether the transition has played to the end (the repository holds exactly the second snapshot and onFinished has been called).

Functions

Link copied to clipboard
open override fun onTick(deltaMs: Long)