Jump to content
Search Community

How do animation so that the text appears in parts

Gustavo Scarpim test
Moderator Tag

Recommended Posts

Welcome to the forums, @Gustavo Scarpim

 

That looks like a pretty simple staggered animation. You could use SplitText to break apart the text, or just manually wrap each letter in a <span> and animate them that way. I'd encourage you to give it a shot and if you run into any trouble, post back here with a minimal demo and we'd be glad to offer some advice. 

 

Happy tweening!

  • Like 1
Link to comment
Share on other sites

My code: 
 

 
export function transformTitle(array) {
array.map((_, index) => {
return tl.from("#title" + index, {
opacity: 0,
ease: SlowMo.easeOut,
duration: 0.04,
});
});
}

export function transformSubtitle(array) {
array.map((_, index) => {
return tl.from("#subTitle" + index, {
opacity: 0,
ease: SlowMo.easeOut,
duration: 0.04,
});
});
}

var tl = gsap.timeline();
const ititle = "Mega man";
const result = ititle?.split("");
setTitle(result);

const isubtitle = "Nintendo";
const result2 = isubtitle?.split("");
setSubTitle(result2);

tl.from("#card1", {
opacity: 0,
duration: 0.8,
rotationY: 180,
stagger: 0.2,
}).from("#titulo1", {
opacity: 0,
duration: .5,
onStart: function () {
transformTitle(result);
},
}).from("#subtitulo1", {
opacity: 0,
duration: 1,
onStart: function () {
transformSubtitle(result2);
},
});
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...