Jump to content
GreenSock

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

Call function in timeline

Recommended Posts

Hi,

Im new here. Can you help me? Im would like to call function in this way. Is it possible? How?

.to('.col-box:nth-child(3)', 1, {opacity: 1,delay: 0.2}, 0)
//a call function
.to('.col-box:nth-child(4)', 1, {opacity: 1,delay: 0.3}, 0)	
.to('.col-box:nth-child(5)', 1, {opacity: 1,delay: 0.4}, 0)	

Thanx

Link to comment
Share on other sites

You can use the .add() method to place a function in the timeline where ever you like.

.to('.col-box:nth-child(3)', 1, {opacity: 1,delay: 0.2}, 0)
.add( function(){ console.log('Woohoo!') } )
.to('.col-box:nth-child(4)', 1, {opacity: 1,delay: 0.3}, 0)	
.to('.col-box:nth-child(5)', 1, {opacity: 1,delay: 0.4}, 0)

See the Pen vgxjQb?editors=1111 by sgorneau (@sgorneau) on CodePen

  • Like 5
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.
×