Class

Ayva

Ayva(configopt)

Constructor

# new Ayva(configopt)

Create a new instance of Ayva with the specified configuration.

Parameters:
Name Type Attributes Description
config Object <optional>
name String <optional>

the name of this configuration

defaultAxis String <optional>

the default axis to command when no axis is specified

axes Array.<Object> <optional>

an array of axis configurations (see Ayva#configureAxis)

View Source ayva.js, line 80

Members

# static defaultConfiguration

Return a copy of the default configuration.

View Source ayva.js, line 1202

Methods

# static blendMotion(firstProvider, secondProvider, factor)

Creates a value provider that is a blend of the two value providers passed. The factor is the multiplier for the values generated by the second provider. The first provider's values will be multiplied by 1 - factor.

Parameters:
Name Type Description
firstProvider function
secondProvider function
factor Number

value between 0 and 1

View Source ayva.js, line 1195

# static linearMotion(from, to, phaseopt, eccopt, bpmopt, shiftopt)

Eccentric Parametric Oscillatory Linear Motion™

Parameters:
Name Type Attributes Description
from Number

the start of the range of motion

to Number

the end of the range of motion

phase Number <optional>

the phase of the motion in multiples of π/2

ecc Number <optional>

the eccentricity of the motion

bpm Number <optional>

beats per minute

shift Number <optional>

additional phase shift of the motion in radians

View Source ayva.js, line 1134

the value provider

# static linearMotion(params)

Eccentric Parametric Oscillatory Linear Motion™

Parameters:
Name Type Description
params Object

the parameters of the motion.

View Source ayva.js, line 1134

the value provider

# static map(value, inMin, inMax, outMinopt, outMaxopt)

Maps a value from one range to another. The default target range is [0, 1]. Does not constrain values to within the range.

This function is analagous to the map() function in the arduino's math library:

https://www.arduino.cc/reference/en/language/functions/math/map/

Parameters:
Name Type Attributes Default Description
value Number
inMin Number
inMax Number
outMin Number <optional>
0
outMax Number <optional>
1

View Source ayva.js, line 1222

# static parabolicMotion(from, to, phaseopt, eccopt, bpmopt, shiftopt)

Eccentric Parametric Oscillatory Parabolic Motion™

Parameters:
Name Type Attributes Description
from Number

the start of the range of motion

to Number

the end of the range of motion

phase Number <optional>

the phase of the motion in multiples of π/2

ecc Number <optional>

the eccentricity of the motion

bpm Number <optional>

beats per minute

shift Number <optional>

additional phase shift of the motion in radians

View Source ayva.js, line 1074

the value provider

# static parabolicMotion(params)

Eccentric Parametric Oscillatory Parabolic Motion™

Parameters:
Name Type Description
params Object

the parameters of the motion.

View Source ayva.js, line 1074

the value provider

# static ramp(fn)

Convert the function provided into a ramp function.

Parameters:
Name Type Description
fn function

View Source ayva.js, line 916

the new ramp function

# static RAMP_COS()

Value provider that generates motion towards a target position that resembles part of a cos wave (0 - 180 degrees).

View Source ayva.js, line 936

# static RAMP_LINEAR()

Value provider that generates motion towards a target position with constant velocity.

View Source ayva.js, line 927

# static RAMP_NEGATIVE_PARABOLIC()

Value provider that generates motion towards a target position in the shape of the first half of an upside down parabola. This creates the effect of "launching" towards the target position.

View Source ayva.js, line 956

# static RAMP_PARABOLIC()

Value provider that generates motion towards a target position in the shape of the latter half of a parabola. This creates the effect of "falling" towards the target position.

View Source ayva.js, line 946

# static tempestMotion(from, to, phaseopt, eccopt, bpmopt, shiftopt)

Creates a value provider that generates oscillatory motion. The formula is:

cos(θ + phase·π/2 + ecc·sin(θ + phase·π/2))

The result is translated and scaled to fit the range and beats per minute specified. This formula was created by Tempest MAx—loosely based on orbital motion calculations. Hence, tempestMotion.

See this graph of the function where you can adjust the parameters to see how they affect the motion.

Parameters:
Name Type Attributes Description
from Number

the start of the range of motion

to Number

the end of the range of motion

phase Number <optional>

the phase of the wave in multiples of π/2

ecc Number <optional>

the eccentricity of the wave

bpm Number <optional>

beats per minute

shift Number <optional>

additional phase shift of the wave in radians

View Source ayva.js, line 1020

the value provider.

Example
// Note: These examples use Move Builders from the Motion API.

// Simple up/down stroke for 10 seconds.
ayva.$.stroke(Ayva.tempestMotion(1, 0), 10).execute();

// ... out of phase with a little eccentricity.
ayva.$.stroke(Ayva.tempestMotion(1, 0, 1, 0.2), 10).execute();

// ... at 30 BPM.
ayva.$.stroke(Ayva.tempestMotion(1, 0, 1, 0.2, 30), 10).execute();

# static tempestMotion(params)

Creates a value provider that generates oscillatory motion. The formula is:

cos(θ + phase·π/2 + ecc·sin(θ + phase·π/2))

The result is translated and scaled to fit the range and beats per minute specified. This formula was created by Tempest MAx—loosely based on orbital motion calculations. Hence, tempestMotion.

See this graph of the function where you can adjust the parameters to see how they affect the motion.

Parameters:
Name Type Description
params Object

the parameters of the motion.

View Source ayva.js, line 1020

the value provider.

Example
// Note: These examples use Move Builders from the Motion API.

// Simple up/down stroke for 10 seconds.
ayva.$.stroke(Ayva.tempestMotion({ from: 1, to: 0}), 10).execute();

// ... out of phase with a little eccentricity.
ayva.$.stroke(Ayva.tempestMotion({ from: 1, to: 0, phase: 1, ecc: 0.2 }), 10).execute();

// ... at 30 BPM.
ayva.$.stroke(Ayva.tempestMotion({ from: 1, to: 0, phase: 1, ecc: 0.2, bpm: 30 }), 10).execute();

# addOutput(…output)

Registers a new output. Ayva outputs commands to all connected outputs. More than one output can be specified.

Parameters:
Name Type Attributes Description
output function | Object <repeatable>

a function or an object with a write() method.

View Source ayva.js, line 422

# addOutputDevice(…device)

Registers a new output device. Ayva outputs commands to all connected devices. More than one device can be specified.

Parameters:
Name Type Attributes Description
device Object <repeatable>

a function or an object with a write method.

Deprecated:
  • since version 0.13.0. Use addOutput() instead.

View Source ayva.js, line 449

# configureAxis(axisConfig)

Configures a new axis. If an axis with the same name has already been configured, it will be overridden.

Parameters:
Name Type Attributes Default Description
axisConfig Object

axis configuration object

name String

the machine name of this axis (such as L0, R0, etc...)

type String

linear, rotation, or auxiliary

alias String <optional>

an alias used to refer to this axis

max Number <optional>
1

specifies maximum value for this axis

min Number <optional>
0

specifies minimum value for this axis

View Source ayva.js, line 316

Example
const ayva = new Ayva();

ayva.configureAxis({
  name: 'L0',
  type: 'linear',
  alias: 'stroke',
  max: 0.9,
  min: 0.3,
});

# defaultConfiguration()

Setup this Ayva instance with the default configuration (a six axis stroker).

View Source ayva.js, line 122

the instance of Ayva

Example
const ayva = new Ayva().defaultConfiguration();

# async do(behavior)

Perform the specified behavior until it completes or is explicitly stopped. If another behavior is running, it will be stopped.

For full details on how to use this method, see the Behavior API tutorial.

Parameters:
Name Type Description
behavior GeneratorBehavior | function | Object

the behavior to perform.

View Source ayva.js, line 144

# getAxes()

Fetch an array of the axes.

View Source ayva.js, line 367

# getAxis(name) → {Object}

Fetch an immutable object containing the properties for an axis.

Parameters:
Name Type Description
name String

the name or alias of the axis to get.

View Source ayva.js, line 348

axisConfig - an immutable object of axis properties.

Object

# getOutput()

Return a list of all outputs.

View Source ayva.js, line 429

# getOutputDevices()

Return a list of all output devices.

Deprecated:
  • since version 0.13.0. Use getOutput() instead.

View Source ayva.js, line 468

# getTimer()

Get the timer that Ayva uses to time movements.

View Source ayva.js, line 132

the timer

# async home(speedopt) → {Promise}

Moves all axes to their default positions.

Parameters:
Name Type Attributes Default Description
speed Number <optional>
0.5

optional speed of the movement.

View Source ayva.js, line 241

A promise that resolves when the movements are finished.

Promise

# move(…movements) → {Promise}

Performs movements along one or more axes. This is a powerful method that can synchronize axis movement while allowing for fine control over position, speed, or move duration. For full details on how to use this method, see the Motion API tutorial.

Parameters:
Name Type Attributes Description
movements Object <repeatable>

View Source ayva.js, line 201

a promise that resolves with the boolean value true when all movements have finished, or false if the move was cancelled.

Promise
Example
ayva.move({
  axis: 'stroke',
  to: 0,
  speed: 1,
},{
  axis: 'twist',
  to: 0.5,
  duration: 1,
});

# moveBuilder()

Creates a MoveBuilder for this instance.

View Source ayva.js, line 231

the new move builder.

# ready() → {Promise}

Wait until ayva is not doing anything (neither moving nor sleeping).

View Source ayva.js, line 216

a promise that resolves when there are no more moves or sleeps queued.

Promise

# removeOutput(output)

Remove the specified output.

Parameters:
Name Type Description
output Object

the output to remove.

View Source ayva.js, line 438

# removeOutputDevice(device)

Remove the specified device.

Parameters:
Name Type Description
device Object

the device to remove.

Deprecated:
  • since version 0.13.0. Use removeOutput() instead.

View Source ayva.js, line 478

# setValues(axisValueMap)

Live update axis values.

Parameters:
Name Type Description
axisValueMap Object

axis to value map

View Source ayva.js, line 409

# sleep(seconds) → {Promise}

Asynchronously sleep for the specified number of seconds (or until stop() is called).

Parameters:
Name Type Description
seconds Number

View Source ayva.js, line 278

a Promise that resolves with the value true if the time elapses. false if the sleep is cancelled.

Promise

# stop()

Cancels all running or pending movements, clears the current behavior (if any), and cancels any sleeps.

View Source ayva.js, line 267

# updateLimits(axis, from, to)

Update the limits for the specified axis.

Parameters:
Name Type Description
axis String
from Number

value between 0 and 1

to Number

value between 0 and 1

View Source ayva.js, line 389