move()
To perform multiaxis movements simply pass additional axes as arguments to the move()
method:
// Slowly stroke to the bottom while twisting to the left.
ayva.move({
to: 0,
speed: 0.25
},{
axis: 'twist',
to: 0,
speed: 0.25
});
Note: Remember that when an axis is not specified, it uses the default axis. Therefore the first axis in this example is the stroke axis.
Try it out!
Everything that has been covered in previous tutorials applies to multiaxis movements (ramps, value providers, etc).
Movements across multiple axes are performed simultaneously and "independently" (i.e. they need not have the same duration). The Promise that move()
returns will resolve when all axes have finished moving:
// The twist axis move in this example is twice as fast
// as the stroke axis move. Therefore, it finishes first.
ayva.move({
to: 0,
speed: 0.25
},{
axis: 'twist',
to: 0,
speed: 0.5
});
Auto Synchronization
If you omit the duration (or speed) for an axis in a multiaxis movement, its duration will automatically be set to the duration of the longest running (slowest) axis:
// The twist and roll axis in this example take on the duration of the stroke axis.
// All axes therefore finish at the same time.
ayva.move({
to: 0,
speed: 0.25
},{
axis: 'twist',
to: 0,
},{
axis: 'roll',
to: 0
});
It follows that at least one axis must specify a speed or duration, or an error will be thrown.
Manual Synchronization
It is possible to instead synchronize the duration of an axis with a specific axis using the sync
property:
// In this example, the longest running move (slowest) is the twist axis.
// However, the roll axis is set to synchronize with the fastest move (the stroke axis).
ayva.move({
to: 0,
speed: 0.5
},{
axis: 'twist',
to: 0,
speed: 0.25
},{
axis: 'roll',
to: 0,
sync: 'stroke'
});
Value Provider Parameters
The parameters passed to value providers in multiaxis movements are unique to each axis (when applicable). See the full list of parameters in the Value Providers documentation.
home()
Ayva provides a convenience method to move all axes to their default values (in the default configuration this is 0.5 for linear axes and 0 for auxiliary axes):
ayva.home();
It returns a Promise that resolves when all the moves have finished.