Jump to content
Search Community

Split text with gsap timeline

Kutomba test
Moderator Tag

Recommended Posts

Hi,

 

I am learning gsap, I found this example on codepen 

 

Now I would like to use gsap.timeline or gsap TimelineMax,  I change it like this 

 

var text = $(".split");

var split = new SplitText(text);
var  tl = new TimelineMax(); // added timelinemax here 
function random(min, max){
	return (Math.random() * (max - min)) + min;
}

$(split.chars).each(function(i){
	tl.from($(this), 2.5, { // and used it here
		opacity: 0,
		x: random(-500, 500),
		y: random(-500, 500),
		z: random(-500, 500),
		scale: .1,
		delay: i * .02,
		yoyo: true,
		repeat: -1,
		repeatDelay: 10
	});
});

 

Unfortunatelly this is not animating as expected, what do I need to change here to get the same result but using timeline?

 

Thanks

Kutomba

See the Pen xGyZXp by natewiley (@natewiley) on CodePen

Link to comment
Share on other sites

Hey Kutomba. It doesn't make much sense to add a timeline to that animation because the tweens are animating infinitely anyway. That's why it doesn't work as expected (because the second tween is placed after a tween of infinite length).

 

Why are you trying to do this? What's your goal?

Link to comment
Share on other sites

Hi Zach,

 I am trying to synchronise with my video timeline,  I learned it's possible to synchronise gsap animation with video timeline,  So Is it possible with this kind of animation to animte using timeline if yes what is missing?

Link to comment
Share on other sites

First, update to GSAP 3 (including using the new syntax) like Craig suggested. Then remove the following because you don't want repeats if you're syncing things most likely:

yoyo: true,
repeat: -1,
repeatDelay: 10

Then add paused: true so that the tween doesn't run. 

 

Then inside of your video's update callback, update the .progress() of your tween.

 

There are several existing threads that sync animations with video. Here are a couple I found after a quick search:

 

  • Like 2
  • Thanks 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.
×
×
  • Create New...