Motion
Some people get dizzy or distracted by things that move. In SonicFrame, decoration never moves unless you ask, and nothing moves for people who asked their system for less motion.
What moves, and when
| Motion | By default | With reduced motion |
|---|---|---|
| The played part, while the sound plays | on (it is the information) | on |
Bars growing in when peaks arrive
(animate)
|
on | never |
The reading button's pulse or fade
(description.button.animation)
|
off | never |
The zoom following the position
(follow)
|
off |
'center' turns a page at a
time
|
A long chapter name going round
(look.marquee); it holds
still under the pointer
(marqueePauseOnHover)
|
off | never |
The player's background drifting
(look.backgroundAnimation)
|
off | never |
The chapter list fading or sliding in
(chapters.list.animation)
|
off | never |
The recorder's REC dot blinking
(recBlink); it holds still
under the pointer and with the focus in
the recorder
|
off | never |
| The volume slider widening as it opens | on | never |
| Live frequency bars | off (a plugin) | your call |
Animation is a switch, its kind another option
Where SonicFrame offers motion, a boolean turns it on and a separate option picks its kind, with a default:
import { createPlayer } from 'sonicframe/player';
createPlayer({
container: document.querySelector('#motion-fade'),
src: './sounds/little-elf.mp3',
a11y: {
description: {
button: { animation: true, animationType: 'fade' }, // 'pulse' by default
},
},
});A kind it does not know falls back to the default, and the whole animation is skipped when the system asks for less motion.
Turning the grow-in off
import { PlayButton, SonicFrame, loadWaveform } from 'sonicframe';
const box = document.querySelector('#motion-still');
box.style.display = 'flex';
box.style.alignItems = 'center';
box.style.gap = '0.75rem';
const media = new Audio('./sounds/little-elf.mp3');
PlayButton.create({ container: box, media });
const wave = document.createElement('div');
wave.style.flex = '1';
wave.style.height = '4rem';
box.append(wave);
new SonicFrame({
container: wave,
media,
peaks: () => loadWaveform('./sounds/little-elf.dat'),
animate: false, // the bars appear at once, without growing in
});