Skip to main content
Participant
Jun 28, 2021 6:24 AM UTC
Answered

Counting up animation for an html5 banner ad

Hello community,

 

I am reaching out because I need to figure out a way to animate a counter going up from 15 to 95 for an html5 banner ad.

 

I tried searching for a solution in the community and found a couple of similar questions but so far the solutions haven't worked for me.

 

Would anyone please be able to assist me with this one? Thank you!

 

This topic is closed to new replies. Start a new post to keep the conversation going.
JoãoCésar17023019
JoãoCésar17023019Correct answer
Community Expert
Jun 28, 2021 11:50 AM UTC

Hi.

 

You can use TweenJS for this kind of animation. Like this:

this.countText.count = 15;

createjs.Tween.get(this.countText).to({ count: 95 }, 1000, createjs.Ease.sineOut).addEventListener("change", function(e)
{
	e.target.target.text = Math.round(e.target.target.count).toString();
});

 

I hope it helps.

 

Regards,

JC

3 replies

JoãoCésar17023019
Community Expert
JoãoCésar17023019Community ExpertCorrect answer
Community Expert
Jun 28, 2021 11:50 AM UTC

Hi.

 

You can use TweenJS for this kind of animation. Like this:

this.countText.count = 15;

createjs.Tween.get(this.countText).to({ count: 95 }, 1000, createjs.Ease.sineOut).addEventListener("change", function(e)
{
	e.target.target.text = Math.round(e.target.target.count).toString();
});

 

I hope it helps.

 

Regards,

JC

Translate
erickjgilAuthor
Participant
Jun 30, 2021 4:39 AM UTC

This worked for me. Thank you so much, JC!

Translate
JoãoCésar17023019
Community Expert
Community Expert
Jun 30, 2021 10:55 AM UTC

Awesome! You're welcome!

Translate