This namespace provides the core of the animation system.
These can be added to game-objects with prospero.game-objects/add-animators
.
Animations can be specified like this:
[path-vector change-desription tag options]
path-vector
is simply a vector of keys pointing to where the value will
be changed. The change-description is used to control the change value.
In the future, there will be a number of other ways to declare animations
and provide custom functions to specify the animation curve. Tag is a spare
parameter that is likely going to be removed. Options are optional, but
can add extra behaviours to the animation.
A value can be changed or set immediately with a description in this format:
[[:path :to :target] [[number unit]] :set opts]
For example to set the column in a sprite animation:
[[:texture :col] [[3 :col-index]] :set]
A constant rate of change can be specified this way:
[[:translation 0] [[20 :pixels] [1 :second]] :constant]
Keys for options include:
:animator-id ; - this name can be used to control animation state via events
:intitial-state ; - :running or :stopped
:limit ; - :constant animation will end here - will deprcate in future
:on-limit ; - :signal or :reset
:limit-signal ; - will send this signal when limit is hit
NB: tag is mostly a free parameter right now, and might be removed in a future release.
This namespace provides the core of the animation system. These can be added to game-objects with `prospero.game-objects/add-animators`. Animations can be specified like this: ``` [path-vector change-desription tag options] ``` `path-vector` is simply a vector of keys pointing to where the value will be changed. The change-description is used to control the change value. In the future, there will be a number of other ways to declare animations and provide custom functions to specify the animation curve. Tag is a spare parameter that is likely going to be removed. Options are optional, but can add extra behaviours to the animation. A value can be changed or set immediately with a description in this format: ``` [[:path :to :target] [[number unit]] :set opts] ``` For example to set the column in a sprite animation: ``` [[:texture :col] [[3 :col-index]] :set] ``` A constant rate of change can be specified this way: ``` [[:translation 0] [[20 :pixels] [1 :second]] :constant] ``` Keys for options include: ``` :animator-id ; - this name can be used to control animation state via events :intitial-state ; - :running or :stopped :limit ; - :constant animation will end here - will deprcate in future :on-limit ; - :signal or :reset :limit-signal ; - will send this signal when limit is hit ``` NB: tag is mostly a free parameter right now, and might be removed in a future release.
This can be extended to provide new animation controls.
This can be extended to provide new animation controls.
Internal multi-method for handling time units in the animator and determing what the rate of change should be. Don't extend this, as it will likely change a lot in future versions.
Internal multi-method for handling time units in the animator and determing what the rate of change should be. Don't extend this, as it will likely change a lot in future versions.
(flip animation-spec)
Given an animation spec, reverse the direction of the change
(proanim/flip [[:translation 1] [[10 :pixels] [1 :second]] :constant])
=>
[[:translation 1] [[-10 :pixels] [1 :second]] :constant]
Given an animation spec, reverse the direction of the change ``` (proanim/flip [[:translation 1] [[10 :pixels] [1 :second]] :constant]) => [[:translation 1] [[-10 :pixels] [1 :second]] :constant] ```
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close