ninmorfeo Posted January 20, 2020 Share Posted January 20, 2020 Hi how can i copy transform on object from another one? ( i have to place a dinamic object at same position of exsisting object) Console give me this error: gsap.min.js:10 Uncaught TypeError: Cannot read property 'style' of undefined at GSCache.getSetter [as set] (gsap.min.js:10) at PropTween._renderPlain [as r] (gsap.min.js:10) at PropTween._renderPropTweens [as r] (gsap.min.js:10) at _renderZeroDurationTween (gsap.min.js:10) at Tween.render (gsap.min.js:10) at new Tween (gsap.min.js:10) at Object.set (gsap.min.js:10) at HTMLDivElement.<anonymous> (tarocchi-zingara-build.js:1152) at HTMLDivElement.dispatch (jquery.js?ver=1.12.4-wp:3) at HTMLDivElement.r.handle (jquery.js?ver=1.12.4-wp:3) the code that i try to use is this one: $('.carta_estratta').on('click', function () { let z_ogg='#'+$(this).attr('id'); matrice= $(z_ogg).css("transform"); console.log(matrice) gsap.set('#'+$(this).attr("id") + '_card', { transform: matrice }); }); in console log i can see result of Matrice....matrix3d(0.6, 0, 0, 0, 0, 0.563816, 0.205212, 0, 0, -0.34202, 0.939693, 0, 685, -96, 0, 1) Link to comment Share on other sites More sharing options...
ZachSaucier Posted January 20, 2020 Share Posted January 20, 2020 Hey ninmorfeo, This is exactly what .getProperty() is for. We don't recommend mixing jQuery's .css() with GSAP as it's really not ever necessary to do. 1 Link to comment Share on other sites More sharing options...
ninmorfeo Posted January 20, 2020 Author Share Posted January 20, 2020 17 minutes ago, ZachSaucier said: Hey ninmorfeo, This is exactly what .getProperty() is for. We don't recommend mixing jQuery's .css() with GSAP as it's really not ever necessary to do. can you make a example please? how can i get $('.carta_estratta') transform property? Link to comment Share on other sites More sharing options...
ninmorfeo Posted January 20, 2020 Author Share Posted January 20, 2020 ok nevermind i found it thanks Link to comment Share on other sites More sharing options...
ZachSaucier Posted January 20, 2020 Share Posted January 20, 2020 Here's how you can do it. Click on the second square to see it update to match the other's transform: See the Pen wvBQyqw?editors=0010 by GreenSock (@GreenSock) on CodePen Just make sure to use the latest beta GSAP file for now because we came across an issue related to setting the transform in GSAP 3.0.5. 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