kaungkz93@gmail.com
Content Type
Profiles
Forums
Store
Blog
Product
Showcase
FAQ
Downloads
Posts posted by kaungkz93@gmail.com
-
-
I personally use Intersection observer + gsap to create animation when user has scrolled to the targeted element.
- 2
-
I am trying to add a defaults values for my fromTo(), I tried putting defaults: {} inside gsap.timeline({}) as below
const tl_shapes = gsap.timeline({ defaults: { opacity: 0 } },{ defaults: { opacity: 1 } });function step_shapes_animation () {return tl_shapes.fromTo(".step-2 .shapes img:first-child",{ x: -200 },{ x: 0, duration: duration }).fromTo(".step-2 .shapes img:last-child",{ y: -200 },{ y: 0, duration: duration },"-=0.4");}I am not sure if this is the right way to do it but second element doesn't seem to work and it starts with initial
opacity: 1
and I guess it is because fromTo() has 2 objects and I can't put 2 objects fordefaults
. I am wondering if there is a right way to do it.
How to create default values for gsap timeline fromTo()
in GSAP
Posted
Thanks for the solutions, I am using for the case where I personally think fromTo is most suitable to use. I tried with object destructuring method and it works since I have more shared values for fromTo tweens.