Module flower.spine.Skeleton
Functions
Skeleton:init (path, attachmentsPath, scaleX, scaleY, scaleZrot) | Create skeleton from json file Flower by default have inverted Y axis (0 at top). |
Skeleton:_initBones () | Initialize bone objects from inner data |
Skeleton:_initSlots () | Initialize slot objects from inner data |
Skeleton:_initAttachments () | Initialize attachment objects from inner data |
Skeleton:_initAnimations () | Initialize animation objects from inner data |
Skeleton:_initEvents () | Initialize custom events from inner data |
Skeleton:getAttachment (attachmentName, slotName) | Returns attachment object for slot |
Skeleton:setLayer (layer) | Set layer for the skeleton Inserts all child slots props to the given layer |
Skeleton:onSceneStop (e) | This event is called when scene is destroyed |
Skeleton:setSkin (skinName) | Set new skin to use |
Skeleton:setToBindPose () | Reset skeleton to initial pose |
Skeleton:playAnim (animationName, loop) | Play animation |
Skeleton:stopAnim (animationName) | Stop animation |
Functions
- Skeleton:init (path, attachmentsPath, scaleX, scaleY, scaleZrot)
-
Create skeleton from json file
Flower by default have inverted Y axis (0 at top). Also, z rotation growth is clockwise.
Spine uses the folowing coordinate conventions: Y is growing from bottom to top,
rotation direction is counter-clockwise
scaleX, scaleY and scaleZrot can be used for coordinate translation from spine to current project.
Parameters:
- path skeleton json path
- attachmentsPath (option) path to attachment images
- scaleX (option) x scale of the skeleton. Can be used to scale skeleton for different resolutions
- scaleY (option) x scale of the skeleton
- scaleZrot (option) rotation scale
- Skeleton:_initBones ()
- Initialize bone objects from inner data
- Skeleton:_initSlots ()
- Initialize slot objects from inner data
- Skeleton:_initAttachments ()
- Initialize attachment objects from inner data
- Skeleton:_initAnimations ()
- Initialize animation objects from inner data
- Skeleton:_initEvents ()
- Initialize custom events from inner data
- Skeleton:getAttachment (attachmentName, slotName)
-
Returns attachment object for slot
Parameters:
- attachmentName name of the attachment
- slotName name of the slot for that attachment
- Skeleton:setLayer (layer)
-
Set layer for the skeleton
Inserts all child slots props to the given layer
Parameters:
- layer layer
- Skeleton:onSceneStop (e)
-
This event is called when scene is destroyed
Parameters:
- e
- Skeleton:setSkin (skinName)
-
Set new skin to use
Parameters:
- skinName skin name
- Skeleton:setToBindPose ()
- Reset skeleton to initial pose
- Skeleton:playAnim (animationName, loop)
-
Play animation
Parameters:
- animationName animation name
- loop (option) loop the animation. Default is false
Returns:
-
animation object
- Skeleton:stopAnim (animationName)
-
Stop animation
Parameters:
- animationName name of animation to stop or nil to stop all animations