(add-effect sprite key fn-3)
(add-effect sprite key from to fn-3)
Register a function to be called when the sprite's state changes
Register a function to be called when the sprite's state changes
(animate sprite)
(animate sprite set-state)
Moves the sprite to an animating state. This is just a convenience function for transitioning to an animating state. It is not required for any purpose other than marking the sprite's state as ::animating
Moves the sprite to an animating state. This is just a convenience function for transitioning to an animating state. It is not required for any purpose other than marking the sprite's state as ::animating
(create-css-renderer)
Create a sprite renderer backed by CSS. This is merely a default renderer
implementation shipped with lemon.lime. Feel free to implement lemon.lime.protocols/Renderer
protocol
if different behavior is desired.
Create a sprite renderer backed by CSS. This is merely a default renderer implementation shipped with lemon.lime. Feel free to implement [[lemon.lime.protocols/Renderer]] protocol if different behavior is desired.
(create-frames sprite-sheet dimensions)
Given the dimensions of the sprite and it's sprite sheet, calcuate the full range of frames available to the sprite. This function can be used to get a collection of frames, but is best used by renderers during the load phase. Frames should be created and then stored in state, as they should not change. See [[lemon.lime.css/create-frames]]
Given the dimensions of the sprite and it's sprite sheet, calcuate the full range of frames available to the sprite. This function can be used to get a collection of frames, but is best used by renderers during the load phase. Frames should be created and then stored in state, as they should not change. See [[lemon.lime.css/create-frames]]
(current-state sprite)
Returns the current state of the given sprite
Returns the current state of the given sprite
(done sprite)
(done sprite set-state)
Moves the sprite out of an animating state. This is just a convenience function for transitioning back to a ready state. It is not required for any purpose other than moving the sprite's state from ::animating to ::ready
Moves the sprite out of an animating state. This is just a convenience function for transitioning back to a ready state. It is not required for any purpose other than moving the sprite's state from ::animating to ::ready
(frames sprite)
Get an ordered collection of frames for the sprite
Get an ordered collection of frames for the sprite
(index-of frame sprite)
Get the index of a frame within a sprite's frame collection. Returns -1 if the frame is not found
Get the index of a frame within a sprite's frame collection. Returns -1 if the frame is not found
(move sprite frame)
Update the sprite's current frame. This state change should be rendered by the sprite's underlying renderer
Update the sprite's current frame. This state change should be rendered by the sprite's underlying renderer
(on-change sprite fn-3)
(on-change sprite key fn-3)
Add an effect handler to be called when the sprite's old and new states are no longer equal in value. When called with 2 arguments, a key will be provided. This will ensure that only one change handler is added. If for some reason multiple change handlers are desired, be sure to provide distinct keys for each handler
Add an effect handler to be called when the sprite's old and new states are no longer equal in value. When called with 2 arguments, a key will be provided. This will ensure that only one change handler is added. If for some reason multiple change handlers are desired, be sure to provide distinct keys for each handler
(reel from sprite)
(reel from to sprite)
Returns a subset of the sprite's frames in a way that is useful for animation. Consider a sprite with 7 frames:
(reel [0 0] [6 0] sprite) => [[0 0] [1 0] [2 0] [3 0] [4 0] [5 0] [6 0]]
Omitting the to value will assume the last frame:
(reel [0 0] sprite) => [[0 0] [1 0] [2 0] [3 0] [4 0] [5 0] [6 0]]
It is also possible to create a reel from start to start:
(reel [0 0] [0 0] sprite) => [[0 0] [1 0] [2 0] [3 0] [4 0] [5 0] [6 0] [0 0]]
Reels can be created that range from later reels to earlier reels:
(reel [1 0] [0 0] sprite) => [[1 0] [2 0] [3 0] [4 0] [5 0] [6 0] [0 0]]
Returns a subset of the sprite's frames in a way that is useful for animation. Consider a sprite with 7 frames: ```clojure (reel [0 0] [6 0] sprite) => [[0 0] [1 0] [2 0] [3 0] [4 0] [5 0] [6 0]] ``` Omitting the to value will assume the last frame: ```clojure (reel [0 0] sprite) => [[0 0] [1 0] [2 0] [3 0] [4 0] [5 0] [6 0]] ``` It is also possible to create a reel from start to start: ```clojure (reel [0 0] [0 0] sprite) => [[0 0] [1 0] [2 0] [3 0] [4 0] [5 0] [6 0] [0 0]] ``` Reels can be created that range from later reels to earlier reels: ```clojure (reel [1 0] [0 0] sprite) => [[1 0] [2 0] [3 0] [4 0] [5 0] [6 0] [0 0]] ```
(sprite config)
(sprite config renderer)
Create a sprite. The rendered outcome of doing so may vary from renderer to renderer. See [[lemon.lime.spec/config]] for the structure of common configuration. Renderers should support namespaced keys for their own configuration. For instance, the default css renderer accepts config identifying a dom id to replace and an optional append function for taking control of dom insertion on your own:
{:uri "shepherd-swing.png"
:height 52
:width 47
::css/renderer {:id "shepherd"
:append appendFn}
Create a sprite. The rendered outcome of doing so may vary from renderer to renderer. See [[lemon.lime.spec/config]] for the structure of common configuration. Renderers should support namespaced keys for their own configuration. For instance, the default css renderer accepts config identifying a dom id to replace and an optional append function for taking control of dom insertion on your own: ```clojure {:uri "shepherd-swing.png" :height 52 :width 47 ::css/renderer {:id "shepherd" :append appendFn} ```
The valid states and transitions for a sprite. Top level keys represent valid states. The map associated with each top level key is a map of events to new states.
The valid states and transitions for a sprite. Top level keys represent valid states. The map associated with each top level key is a map of events to new states.
(transition sprite event)
(transition sprite event payload)
Transition the sprite to a new state. See lemon.lime/sprite-states
for allowed states
and their events
Transition the sprite to a new state. See [[lemon.lime/sprite-states]] for allowed states and their events
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close