page
fun FlipBook.page(appearance: WithAppearance?, seconds: Float, block: FlipBookPageBuilder.() -> Unit? = null)
Syntactic sugar for adding a FlipBookPage to a FlipBook.
Example code :
val game = PlayActView.instance.game
val square = game.find(...) as Appearance
val triangle = game.find(...) as Appearance
val myAnimation = flipBookAnimation(actor) {
// Square for 1 second, rotating (will complete a full turn)
page(square, 1f) {
tick { actor, seconds -> actor.angleDegrees += seconds * 360f }
}
// Pause to 1/2 second
page(null, 0.5f)
// Triangle for 1 second, rotate in the opposite direction
page(triangle, 1f) {
tick { actor, seconds -> actor.angleDegrees -= seconds * 360f }
}
// Pause to 1/2 second
page(null, 0.5f)
}
Content copied to clipboard
If you want to define a FlipBook for use by many actors, then :
val myFlipBook = flipBook(actor) {
... (same body as before)
}
myFlipBook.applyToActor( actor1 )
myFlipBook.applyToActor( actor2 )
Content copied to clipboard