Pattern cookbook
Ready-made patterns for your app. Play each one on a virtual or real toy, then copy the code.
Toy
Paste your test key to start. It stays in this page only.
Patterns for every toy
Motor patterns built with toy.pattern(). They play on all 13 models.
Tease
Every toyShort, gentle touches with pauses that get a little stronger each time.
20 s, looping
Show code
await toy.pattern({
steps: [
{ strength: 20, ms: 600 },
{ strength: 0, ms: 400 },
{ strength: 30, ms: 600 },
{ strength: 0, ms: 400 },
{ strength: 45, ms: 800 },
{ strength: 0, ms: 600 },
],
loop: true,
durationMs: 20000,
});Connect a toy to play.
Wave
Every toyA smooth rise and fall, about two seconds per wave.
20 s, looping
Show code
await toy.pattern({
steps: [
{ strength: 20, ms: 250 },
{ strength: 35, ms: 250 },
{ strength: 50, ms: 250 },
{ strength: 65, ms: 250 },
{ strength: 80, ms: 250 },
{ strength: 65, ms: 250 },
{ strength: 50, ms: 250 },
{ strength: 35, ms: 250 },
],
loop: true,
durationMs: 20000,
});Connect a toy to play.
Heartbeat
Every toyA double beat and a rest, like a pulse.
15 s, looping
Show code
await toy.pattern({
steps: [
{ strength: 70, ms: 150 },
{ strength: 0, ms: 120 },
{ strength: 90, ms: 200 },
{ strength: 0, ms: 700 },
],
loop: true,
durationMs: 15000,
});Connect a toy to play.
Pulse
Every toyStrong, even on-off beats. Good for a game event.
10 s, looping
Show code
await toy.pattern({
steps: [
{ strength: 80, ms: 300 },
{ strength: 0, ms: 300 },
],
loop: true,
durationMs: 10000,
});Connect a toy to play.
Build-up
Every toyClimbs from 10% to 100% over ten seconds, then stops.
10 s
Show code
await toy.pattern({
steps: [
{ strength: 10, ms: 1000 },
{ strength: 20, ms: 1000 },
{ strength: 30, ms: 1000 },
{ strength: 40, ms: 1000 },
{ strength: 50, ms: 1000 },
{ strength: 60, ms: 1000 },
{ strength: 70, ms: 1000 },
{ strength: 80, ms: 1000 },
{ strength: 90, ms: 1000 },
{ strength: 100, ms: 1000 },
],
loop: false,
durationMs: 10000,
});Connect a toy to play.
Staircase
Every toyHolds each level for two seconds: 25, 50, 75, 100, then again.
24 s, looping
Show code
await toy.pattern({
steps: [
{ strength: 25, ms: 2000 },
{ strength: 50, ms: 2000 },
{ strength: 75, ms: 2000 },
{ strength: 100, ms: 2000 },
],
loop: true,
durationMs: 24000,
});Connect a toy to play.
Rumble
Every toyUneven, rolling bursts. Good for an explosion or a big moment.
8 s, looping
Show code
await toy.pattern({
steps: [
{ strength: 60, ms: 150 },
{ strength: 90, ms: 100 },
{ strength: 40, ms: 200 },
{ strength: 100, ms: 150 },
{ strength: 70, ms: 100 },
{ strength: 30, ms: 200 },
],
loop: true,
durationMs: 8000,
});Connect a toy to play.
For toys that do more
Each one checks the capability first (toy.info), so it's safe to call on any toy.
Second motor heartbeat
Dual motorPlays the heartbeat on motor 2 only. On dual-motor toys (Eclipse).
15 s, looping
Show code
const heartbeat = [{ strength: 70, ms: 150 }, { strength: 0, ms: 120 }, { strength: 90, ms: 200 }, { strength: 0, ms: 700 }];
if (toy.info.motors === 2) {
await toy.pattern({ motor: 2, steps: heartbeat, loop: true, durationMs: 15000 });
}Connect a toy to play.
Suction pulse
SuctionPulsing suction for 30 seconds. On Aurora the motor makes the suction, so a pattern pulses it.
30 s, looping
Show code
const pulse = [{ strength: 80, ms: 300 }, { strength: 0, ms: 300 }];
if (toy.info.suction) {
// Aurora's motor makes the suction: a pattern pulses it.
await toy.pattern({ steps: pulse, loop: true, durationMs: 30000 });
}Connect a toy to play.
Warm welcome
HeatLow heat for five minutes, with a slow wave for the first minute. On heating toys (Ember).
60 s, looping
Show code
const wave = [{ strength: 20, ms: 250 }, { strength: 35, ms: 250 }, { strength: 50, ms: 250 }, { strength: 65, ms: 250 }, { strength: 80, ms: 250 }, { strength: 65, ms: 250 }, { strength: 50, ms: 250 }, { strength: 35, ms: 250 }];
if (toy.info.heating) {
await toy.heat({ level: 'low', durationMs: 300000 });
await toy.pattern({ steps: wave, loop: true, durationMs: 60000 });
}Connect a toy to play.