# Skeleton

Class · category: Animation (Legacy)

Source: https://github.com/playcanvas/engine/blob/f059dc005842f76e052cdf44d8370c8c7ec475ac/src/scene/animation/skeleton.js#L39

Represents a skeleton used to play animations.

## Constructors

### constructor

```ts
new Skeleton(graph: GraphNode)
```

Create a new Skeleton instance.

**Parameters**

- `graph` ([`GraphNode`](https://api.playcanvas.com/engine/classes/GraphNode.md)): The root [GraphNode](https://api.playcanvas.com/engine/classes/GraphNode.md) of the skeleton.

## Properties

### looping

```ts
looping: boolean = true
```

Determines whether skeleton is looping its animation.

## Accessors

### animation

```ts
get animation(): Animation
set animation(value: Animation)
```

Gets the animation on the skeleton.

### currentTime

```ts
get currentTime(): number
set currentTime(value: number)
```

Gets the current time of the currently active animation in seconds.

### numNodes

```ts
get numNodes(): number
```

Gets the number of nodes in the skeleton.

## Methods

### addTime

```ts
addTime(delta: number): void
```

Progresses the animation assigned to the specified skeleton by the supplied time delta. If
the delta takes the animation passed its end point, if the skeleton is set to loop, the
animation will continue from the beginning. Otherwise, the animation's current time will
remain at its duration (i.e. the end).

**Parameters**

- `delta` (`number`): The time in seconds to progress the skeleton's animation.

### blend

```ts
blend(skel1: Skeleton, skel2: Skeleton, alpha: number): void
```

Blends two skeletons together.

**Parameters**

- `skel1` ([`Skeleton`](https://api.playcanvas.com/engine/classes/Skeleton.md)): Skeleton holding the first pose to be blended.
- `skel2` ([`Skeleton`](https://api.playcanvas.com/engine/classes/Skeleton.md)): Skeleton holding the second pose to be blended.
- `alpha` (`number`): The value controlling the interpolation in relation to the two input
  skeletons. The value is in the range 0 to 1, 0 generating skel1, 1 generating skel2 and
  anything in between generating a spherical interpolation between the two.

### setGraph

```ts
setGraph(graph: GraphNode): void
```

Links a skeleton to a node hierarchy. The nodes animated skeleton are then subsequently used
to drive the local transformation matrices of the node hierarchy.

**Parameters**

- `graph` ([`GraphNode`](https://api.playcanvas.com/engine/classes/GraphNode.md)): The root node of the graph that the skeleton is to drive.

### updateGraph

```ts
updateGraph(): void
```

Synchronizes the currently linked node hierarchy with the current state of the skeleton.
Internally, this function converts the interpolated keyframe at each node in the skeleton
into the local transformation matrix at each corresponding node in the linked node
hierarchy.
