Event callbacks

The DotLottieAnimation instance emits the following events that can be listened to via a class implementing the Observer protocol:

class YourDotLottieObserver: Observer {
func onComplete() {
// do something
}
func onFrame(frameNo: Float) {
// do something
}
func onLoad() {
// do something
}
func onLoadError() {
// do something
}
func onLoop(loopCount: UInt32) {
// do something
}
func onPause() {
// do something
}
func onPlay() {
// do something
}
func onRender(frameNo: Float) {
// do something
}
func onStop() {
// do something
}
}
// In your view code
var animation = DotLottieAnimation(...)
var animationView = DotLottieView(dotLottie: animation)
var myObserver = YourDotLottieObserver()
animationView.subscribe(observer: myObserver)
EventDescription
onCompleteEmitted when the animation completes.
onFrame(frameNo: Float)Emitted when the animation reaches a new frame.
onLoadEmitted when the animation is loaded.
onLoadErrorEmitted when the animation failed to load.
onLoop(loopCount: UIint32)Emitted when the animation completes a loop.
onPauseEmitted when the animation is paused.
onPlayEmitted when the animation starts playing.
onRender(frameNo: Float)Emitted when the frame is rendered.
onStopEmitted when the animation is stopped.