Platinum sponsors

muted NEW JS

Disables the value updates, the callbacks and the completion promise of an animation, while keeping its timing.

A muted animation runs like the others: it begins, loops and completes at the same times, so the timing of a timeline does not change when a child is muted, but it writes nothing and calls nothing.

Accepts

Boolean

Default

false

muted is set at creation and cannot change afterwards: recreate the animation to mute or unmute it.

Muting one property

A property can be muted on its own by passing an object with muted: true as its value. The property keeps its place in the animation but is not written.

animate(target, {
  x: 100,
  rotate: { to: 90, muted: true },
});

muted is a reserved parameter name, so a target property named muted cannot be animated.

muted code example

import { animate } from 'animejs';

animate('.square-a', {
  x: '17rem',
  rotate: 90,
  loop: true,
  alternate: true,
});

animate('.square-b', {
  x: '17rem',
  rotate: 90,
  loop: true,
  alternate: true,
  muted: true,
});

animate('.square-c', {
  x: '17rem',
  rotate: { to: 90, muted: true },
  loop: true,
  alternate: true,
});
<div class="medium row">
  <div class="square square-a"></div>
  <div class="padded label">muted: false</div>
</div>
<div class="medium row">
  <div class="square square-b"></div>
  <div class="padded label">muted: true</div>
</div>
<div class="medium row">
  <div class="square square-c"></div>
  <div class="padded label">rotate: { to: 90, muted: true }</div>
</div>
Previous
Next