Skip to content

Accessibility ​

The accessibility settings a script can adapt to, exposed as environment.accessibility.

Scenery plays an experience as authored; these let the author decide what to tone down.

Properties ​

reduceMotion read-only ​

  • Type: boolean
  • true while the person has asked for less motion: Reduce Motion on Apple devices, prefers-reduced-motion on the web. Replace loops, shakes and fly-ins with fades or stills.

Example:

javascript
if (!environment.accessibility.reduceMotion) {
    ring.animateTo({ scale: 2.2, opacity: 0 }, 1.6, { repeatCount: -1 });
}

Methods ​

on() ​

javascript
on(event: string, callback: function): any

Subscribe to changes of the accessibility settings. Supported: 'change' → callback(), fired when the person turns Reduce Motion on or off while the experience runs. Read the new value from environment.accessibility.

Example:

javascript
function updatePulse() {
    ring.stopAnimations();
    if (!environment.accessibility.reduceMotion) {
        ring.animateTo({ scale: 2.2, opacity: 0 }, 1.6, { repeatCount: -1 });
    }
}
updatePulse();
environment.accessibility.on('change', updatePulse);

Parameters:

  • event (string)
  • callback (function)

Returns: any