Remco Posted May 17, 2022 Share Posted May 17, 2022 Hi all! I love to set some defaults at the start of my project, like the default duration and ease. Is it possible to set defaults specific for FROM or TO animations? Something like this: gsap.defaults({ 'from': { ease: 'power3.in', duration: 0.6 }, 'to': { ease: 'power1.out', duration: 0.2 } }); Any idea? 1 Link to comment Share on other sites More sharing options...
Cassie Posted May 17, 2022 Share Posted May 17, 2022 Not like that I'm afraid but you could do this... It's a little more repetitive, but less so than writing out the properties every time let fromdefaults = { some: stuff, some: morestuff, } tl.from('.elem', { yPercent: 200, ...fromDefaults }) Link to comment Share on other sites More sharing options...
Remco Posted May 17, 2022 Author Share Posted May 17, 2022 Thanks Cassie, that's nice solution which im using too for now. Maybe in a future version of GSAP . 1 Link to comment Share on other sites More sharing options...
Carl Posted May 17, 2022 Share Posted May 17, 2022 You also might be interested in registerEffect() Once you put a little time into making an effect, they require very little code to customize See the Pen LYNBZww by snorkltv (@snorkltv) on CodePen 3 Link to comment Share on other sites More sharing options...
Remco Posted May 18, 2022 Author Share Posted May 18, 2022 Never thought of that for my solution. Thanks Carl! 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