Ligamen

Constraints

Sliders

A slider poses the skeleton with another animation. Instead of keying every bone of a mechanism, you animate the mechanism once as an ordinary clip, for example a flower opening, and a slider plays that clip to a time that something else decides: a number you key, or a property of a bone such as the rotation of a lever. This is how a character gets a face with a few controls, how a lever opens a flower, and how a gentle sway is laid over a whole animation. This article shows how to create a slider, what the rows of the Constraints panel do, how the Frame and Bone modes choose the time, what Range, Loop, Additive and Local change, and how to key a slider in Animate.

A slider constraint in the Constraints panel

How a slider works#

A slider has a driven animation, which is the clip it plays, and a time in that clip. At every moment it poses the bones and the slots that the driven clip keys, as the clip would look at that time, and blends the result with the current pose by Mix. Bone channels and slot channels both follow the clip: attachment, colour, deform, draw order and sequence frame. The constraints of the driven clip are not applied, so a slider never starts another slider.

The time comes from one of two places. In Frame mode the slider has its own Frame value, which you set in Setup or key in Animate. In Bone mode the time is calculated from a property of a source bone, so the pose follows the bone. A slider is solved in the shared order of the Constraints panel (see IK constraints). The result at a given time depends only on the pose and the time, so scrubbing, playback and export agree.

Creating a constraint#

Right-click a bone in the Tree, choose New and Slider. The slider is created in Bone mode with that bone as the source. In a group of selected bones, one slider is created for each bone. The New entry in the Constraints section of the Tree creates a slider that uses the last selected bone as the source, or a Frame slider if no bone is selected. The New button of the Constraints panel opens the New constraint dialog with the Slider type, where the Target is the driven animation.

A new slider drives the first animation that is not the current one, because a slider must not drive the clip it is keyed in. If there is only one animation, it takes that one, and without animations the Animation field stays empty. A new slider is named Slider constraint, Slider constraint 2 and so on, and it is added at the end of the order. Every creation is one undo step.

The rows of the panel#

Select the slider in the Constraints panel or in the Tree. The detail shows SL · Frame mode or SL · Bone mode in its header. Animation is the driven clip; click the chip to choose another one, or use the crosshair. Mode has two buttons, Frame and Bone. Choosing Frame removes the source bone, and choosing Bone asks for one. The Options row has the Loop and Additive switches, and Local as well in Bone mode. Skin has the Skin required switch. The Mix slider at the bottom and the eye in the list row work as for IK (see IK constraints). The SL chip of the filter shows only sliders.

In Frame mode there is one more row, Frame: the time of the driven clip in frames. Click it and type a number. In Bone mode the rows Bone, Property and Range take its place and are explained below.

Frame mode#

Use Frame mode when the time is something you want to control directly. In Setup the Frame value is the pose that the slider holds. In Animate, typing a new Frame writes a key at the playhead and does not touch the setup value, and the status line reports it. Two keys on Frame, from 0 to the last frame of the driven clip, play that clip once over the length of your animation. The slider can do things that the clip alone cannot: you can play it backwards, hold it, or ease it with a curve.

A typical use is a facial expression. Animate smile as a clip of a few frames, create a Frame slider for it and key its Frame only when the face should change. Several sliders can drive several clips at once, each with its own Mix.

Bone mode#

In Bone mode a bone is the control. Pick the Bone and its Property: rotate, x, y, scaleX, scaleY or shearY. The time of the driven clip is then To plus the value of the property minus From, multiplied by Scale. The Range row holds the three numbers. From is the value of the property at which the clip is at its To time, To is the starting frame of the clip and is shown in frames, such as To 0f, and Scale is the number of seconds of the clip per unit of the property, ×1 by default.

For a lever that opens a flower, put From 0 for the closed lever, and choose Scale so that the full travel of the lever, say 90 degrees, covers the length of the clip. If the clip is one second, Scale is 1 divided by 90. Then rotating the lever in the viewport plays the clip, and the viewport labels the source bone with the animation name and the frame, for example bloom 12f. Local reads the property from the local pose of the bone, in the space of its parent, and not from the world transform.

Loop, Additive and Mix#

At the ends of the driven clip the time is held, which is called clamping, and Loop wraps it around instead. Use Loop when the control is something that turns many times, such as a wheel, and the clip is a cycle. Additive changes how the pose is combined. Normally the clip replaces the pose of the bones it keys, blended by Mix. With Additive the clip is added on top of the pose as an offset, so the bones keep their own animation and the clip only moves them. Use it for a sway or breathing that is laid over any animation.

Mix goes from 0 to 100% and blends the effect in. A mix of 0 turns the slider off. In Animate the Keys row has two chips, Frame and Mix. A chip writes the value that is shown at the playhead as a key, and stops playback. Keys on Mix switch a slider on only for a part of the animation.

Order and the Dopesheet#

The order of constraints matters for sliders. A slider that reposes a parent bone rebuilds its children from their keys, so put a slider that drives the children after the one that drives their parent. Drag the rows in the list to change the order, as for any constraint. The Dopesheet shows the keys of a slider on its own row, so you can move and delete them like other keys (see Keys).

Sliders and skins#

A slider can belong to a skin. Turn on Skin required in the Skin row and the slider runs only while a skin that lists it, or default, is on. Add it to a skin with Skin Membership in the Tree (see Skins). Sliders are kept in .ligamen and in the Spine 4.3 binary skeleton. Other formats, which have no sliders, get the effect baked into ordinary bone and slot keys, with a warning. The demo scene docs/examples/slider/flower.ligamen has a lever that opens a flower (slider bloom, Bone mode, clip pull) and an additive Frame slider that sways the stem (slider breeze, clip windy).