Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Runtime API

This section will only acknowledge runtimes included in the Engine Runtimes Table. Others may be used, but could have a different API that is not supported.

For developing runtimes, please see the Developer Documentation.

Functions

Load()

(root, texture) = Load("skellington.skf")

Loads the SkelForm file that is provided.

Returns the root (containing the armature, among other data) and texture.

FormatFrame()

frame: int = FormatFrame(20, armature.animations[0], false, true)

A helper function to format the provided number into a usable frame for the animation, with options like reversing or looping.

If first animation has 14 frames, frame will be 6 (since loop is true).

frame will be used later for animate().

TimeFrame()

frame: int = TimeFrame(time.duration(), armature.animations[0], false, true)

A helper function to format the provided time into a usable frame for the animation, with the same options as formatFrame().

Assuming:

  • time.Duration() is 0.5s
  • Animation is 60 FPS
  • Animation is 60 frames long

frame will be 30.

Animate()

animOptions = {
  blendFrames: [20]
}

drawnBones = Animate(armature, [armature.animations[0]], [frame], animOptions)

Takes the armature, as well as the animation(s) and frame(s). The bones in the armature are then processed accordingly.

Returns a new set of bones to be later drawn via draw().

Additional options may be given such as speed, transform modifiers, and blending (per animation).

Blending will ‘blend’ animations transforms. This is great for eg; smooth animation transitions.

Draw()

Draw(drawnBones, armature.styles, texture)

Draw the provided bones on-screen.

The bones provided must be from animate(). It cannot be the armature’s bones directly.

The ??? parameter is engine-dependent, but usually just requires passing the renderer.