WiggleBone Reference

WiggleBone

This class takes control of a single bone, and makes it behave like a wiggle bone.

Example

import { WiggleBone } from "wiggle";

const wiggleBone = new WiggleBone(targetBone, {
  velocity: 0.1,
});

const loop = () => {
  requestAnimationFrame(loop);
  wiggleBone.update();
};
loop();

Constructor

WiggleBone(target: Bone, options: Object)
  • target (required) – reference to the bone that is going to behave like a wiggle bone.

Options:

  • velocity (optional, default 0.1) – value between 0 and 1 that determines how fast the wiggle bone moves.

Methods

.reset()

Resets the bone to its original transform relative to its parent.

.update(dt: Number)

Animates the bone so it aims to its original transform relative to it's parent.

  • dt (optional) – time delta since the last update. If not provided, this is calculated internally using performance.now()
.dispose()

Removes the wiggle bone and reverts the hierarchy to the original state.

Supported by