Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use new TimelineMax() for better control #6

Open
shshaw opened this issue Mar 7, 2017 · 1 comment
Open

Use new TimelineMax() for better control #6

shshaw opened this issue Mar 7, 2017 · 1 comment

Comments

@shshaw
Copy link
Contributor

shshaw commented Mar 7, 2017

Instead of attaching directly to the user's timeline, create a new TimelineMax instance to allow for attaching to event callbacks and controlling repeats.

Rough idea of how it might used:

var playerTL = new TimelineMax();
playerTL.add( params.playerTL ); // User timeline is added and now has set the whole duration of the new Timeline.

playerTL.eventCallback('onUpdate',function(){
  var p = playerTL.progress();
  slider.value = p * 100;

  var wasPlaying = isPlaying;
  isPlaying = !playerTL.paused();
  if ( wasPlaying !== isPlaying ) {
    TweenMax.set( isPlaying ? play : pause, { opacity: 0 });
    TweenMax.set( isPlaying ? pause : play, { opacity: 1 });
  }
});
@shshaw shshaw changed the title Use new TimelineMax for better control Use new TimelineMax() for better control Mar 7, 2017
@sdras
Copy link
Owner

sdras commented Mar 7, 2017

Great idea!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants