tiramisu/object3d

Types

Declarative animation state - describes what animation should be playing

pub type Animation {
  Animation(
    clip: AnimationClip,
    loop: LoopMode,
    speed: Float,
    weight: Float,
  )
}

Constructors

Opaque type for Three.js AnimationClip

pub type AnimationClip

Animation playback configuration - single animation or blend

pub type AnimationPlayback {
  SingleAnimation(Animation)
  BlendedAnimations(
    from: Animation,
    to: Animation,
    blend_factor: Float,
  )
}

Constructors

  • SingleAnimation(Animation)

    Play a single animation

  • BlendedAnimations(
      from: Animation,
      to: Animation,
      blend_factor: Float,
    )

    Blend between two animations

Animation loop mode

pub type LoopMode {
  LoopOnce
  LoopRepeat
}

Constructors

  • LoopOnce
  • LoopRepeat

Opaque type for Three.js Object3D (loaded 3D models)

pub type Object3D

Values

pub fn clip_duration(clip: AnimationClip) -> Float

Get the duration of an animation clip (in seconds)

pub fn clip_name(clip: AnimationClip) -> String

Get the name of an animation clip

pub fn new_animation(clip: AnimationClip) -> Animation

Create an animation from a clip with default settings (loop repeat, normal speed, full weight)

pub fn set_loop(anim: Animation, mode: LoopMode) -> Animation

Set the loop mode

pub fn set_speed(anim: Animation, speed: Float) -> Animation

Set the animation speed (1.0 = normal, 2.0 = double speed, 0.5 = half speed)

pub fn set_weight(anim: Animation, weight: Float) -> Animation

Set the animation weight (0.0 to 1.0, for blending animations)

Search Document