nodesnim/core/animation

Types

AnimationObj[T] = object
  frame*: int
  speed*, current*: float
  name*: string
  frames*: seq[T]
AnimationRef[T] = ref AnimationObj[T]
AnimationArray[T] = seq[AnimationRef[T]]

Procs

proc Animation[T](name: string; speed: float = 1.0'f32): AnimationRef[T] {...}{.
    inline.}

Creates a new Animation object.

Arguments:

  • name is an animation name.
  • speed is an animation speed.

Example:

var
  anim = Animation[int]("animation", 10f)
proc addFrame[T](anim: AnimationRef[T]; frame: T) {...}{.inline.}
Adds a new frame in the animation.
proc `==`[T](x, y: AnimationRef[T]): bool {...}{.inline.}
proc `[]`[T](arr: AnimationArray[T]; index: string): AnimationRef[T]
proc contains[T](arr: AnimationArray[T]; name: string): bool
proc contains[T](arr: AnimationArray[T]; animation: AnimationRef[T]): bool