H
H
hckn2018-09-17 19:41:03
Animation
hckn, 2018-09-17 19:41:03

Why does the animation only work when it appears?

Why only works on enter? https://codesandbox.io/s/qz4j9n5zzq

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2018-09-17
@hckn

You call done immediately after the show change, so the element is removed immediately without waiting for the animation to finish. You need to use the onComplete callback:

leave(el, done) {
  TweenMax.to(el, 1, {
    x: 0,
    onComplete: done,
  });
},

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question