p4tric Posted June 20, 2021 Share Posted June 20, 2021 Hi, Is there a function or method on gsap where I can get the generated css for the particular animation? For example: (gsap.to(selector, {...}) => get the generated css Link to comment Share on other sites More sharing options...
OSUblake Posted June 20, 2021 Share Posted June 20, 2021 You can get the current value using the gsap.getProperty() method. gsap.to(".box", { x: 200, onUpdate() { console.log(gsap.getProperty(".box", "x")); } }); 1 Link to comment Share on other sites More sharing options...
p4tric Posted June 20, 2021 Author Share Posted June 20, 2021 Thanks @OSUblake Will try this out. Link to comment Share on other sites More sharing options...
p4tric Posted June 20, 2021 Author Share Posted June 20, 2021 Hi @OSUblake Just tried this and it is just returning the value of that specific property. I need the css generated by gsap.to like "translate(... ... ..)" Link to comment Share on other sites More sharing options...
OSUblake Posted June 20, 2021 Share Posted June 20, 2021 You can get if from the style object. https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style myElement.style.transform 1 Link to comment Share on other sites More sharing options...
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