sameermemon Posted March 4, 2020 Posted March 4, 2020 Hi, I have an element placed at right of the screen. I wanted to animate the element from right to its original position. Currently I am applying x property but it is animating the element from left to its original position.
mikel Posted March 4, 2020 Posted March 4, 2020 Hey @sameermemon, Welcome to the GreenSock Forum. Without seeing your code it is difficult to understand your problem. Here an example which could be helpful See the Pen WNvELPE by mikeK (@mikeK) on CodePen. Happy tweening ... Mikel 1
sameermemon Posted March 4, 2020 Author Posted March 4, 2020 Thanks for the quick solution Mikel. I used below code to solve the issue - gsap.fromTo("#box",{ x : 50, opacity : 0 }, { x : 0, opacity : 1 }); Let me know, if it is valid one.
mikel Posted March 4, 2020 Posted March 4, 2020 Hey @sameermemon, Your code looks fine. Be aware of the defaults of duration and ease if that is a point: duration The duration of the animation (in seconds). Default: 0.5 ease Controls the rate of change during the animation, giving it a specific feel. Default: "power1.out" Happy tweening ... Mikel 1
ZachSaucier Posted March 4, 2020 Posted March 4, 2020 5 hours ago, sameermemon said: I used below code to solve the issue - gsap.fromTo("#box",{ x : 50, opacity : 0 }, { x : 0, opacity : 1 }); Let me know, if it is valid one. It is valid, but you can just use a .from() tween like Mikel's demo and it'd be simpler
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now