Skip to content

[BUG] Cannot loop when using relative tween value #1025

@arnaudjuracek

Description

@arnaudjuracek

Describe the bug

Looping animations cannot use relative tween type values.

Provide a minimal reproduction demo of the bug

import { animate } from "https://esm.sh/animejs";

animate('.square', {
  rotate: '+=10',
  loop: true,
  onLoop: self => self.refresh()
});

When using the JS above on https://codepen.io/juliangarnier/pen/pvoGoxR, the square rotate 10 degrees then stops.

Describe the expected behavior

The square should rotate infinitely by increment of 10 degrees.

Using the following code result in the expected behavior:

import { animate, utils } from "https://esm.sh/animejs";

animate('.square', {
  rotate: target => utils.get(target, 'rotate', false) + 10,
  loop: true,
  onLoop: self => self.refresh()
});

Metadata

Metadata

Assignees

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions