Jump to content
GreenSock

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

gsap.registerEffect with multiple tweens

Go to solution Solved by ZachSaucier,

Recommended Posts

It's posible to wrap multiple tweens as an effect, no just one? 

For example: 

gsap.registerEffect({
        name: 'decodeWord',
        effect: (targets, config) => {
          gsap.set(targets, {
            color: 'white',
            textShadow: `0 0 0`
          });
          gsap.to(targets, {
            duration: 1,
            opacity: 1,
            scrambleText: {
              text: config.newText, 
              chars:'lowerCase', 
              revealDelay: 1, 
              tweenLength:false 
              },
          })

            return gsap
        },
        defaults: {}, //defaults get applied to any "config" object passed to the effect
        extendTimeline: true, //now you can call the effect directly on any GSAP timeline to have the result immediately inserted in the position you define (default is sequenced at the end)
      })

 

Link to comment
Share on other sites

  • Solution

Hey Andres and welcome to the GreenSock forums.

 

Sure, it's possible. You just need to create a timeline inside of the effect and return the timeline. Demo.

  • Like 3
Link to comment
Share on other sites

  • ZachSaucier changed the title to gsap.registerEffect with multiple tweens

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.

×