Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
harp

General question about gsap with es6 classes

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

I'm just wondering because I have been using es6 class structure with gsap and its great - the forum members helped me discover this and I love it.
I have been doing some reading and discovered that functional programming is also great too. Does anyone recommend creating animations with a functional programming approach? 

Thank you, I'm a novice so just trying to research about such topics.

Link to comment
Share on other sites

Functional programming (FP) has become pretty popular thanks in part to libraries like lodash, React, and RxJS, but I don't know if I can recommend it if you're just looking for a neat way to work with GSAP. Well, at least not if you're still learning about how objects and functions work in JavaScript. FP involves passing data around to a bunch of different functions to get a result.

 

And a lot of FP is focused around not mutating objects, but that is what GSAP does. In order to create an animation, GSAP has to mutate an object. This is contrast to CSS based animations where you don't have to mutate an object to animate it.

 

I'm not arguing against using FP, but I would stick with learning the basics first, and then see if FP is a better fit later on. I've made a couple posts in the past using a little FP, but I think all I did was confuse everybody.

 

Like here...

 

 

And here...

 

 

  • Like 1
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×