juliangarnier / anime

JavaScript animation engine
https://animejs.com
MIT License
50.42k stars 3.68k forks source link

The update callback has not be called at the beginning of the animation #750

Open Flying-Snail opened 3 years ago

Flying-Snail commented 3 years ago

Describe the bug when the update callback be called。the targets.value has changed twice

To Reproduce

import anime from "animejs";

const targets = {
  val: 19.1201
};
console.log("============ origin val ============");
console.log(targets.val);
anime({
  targets,
  val: 0.95,
  duration: 1500,
  easing: "linear",
  begin: () => {
    console.log("============ begin ============");
    console.log(targets.val);
  },
  update: () => {
    console.log("============ update ============");
    console.log(targets.val);
  }
});

Expected behavior

============ origin val ============
19.1201
============ begin ============
18.513836443400002
============ update ============
18.3117485912    <-----  look at the first update, it contains two changes of targtes
============ update ============
18.109660739000002
============ update ============
17.9075728868
============ update ============
17.705485034600002
============ update ============
...

Desktop (please complete the following information):