Jump to content
Search Community

Syncing a timeline with a video

friendlygiraffe test
Moderator Tag

Go to solution Solved by Diaco,

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

  • Solution

Hi friendlygiraffe  :)

 

you can use TweenLite.ticker to sync tween progress with video currentTime on every tick .

 

something like this :

var vid = document.getElementById("myVideo");
var tween = TweenMax.to( obj , 2 , { ... , ease:Linear.easeNone , paused:true });

function Update(){
  tween.progress( vid.currentTime/vid.duration )
};

vid.onplay = function() {
    TweenLite.ticker.addEventListener('tick',Update);
};
vid.onpause = function() {
    TweenLite.ticker.removeEventListener('tick',Update);
};

 

pls check this out : 

See the Pen JXXOQy by MAW (@MAW) on CodePen

  • Like 4
Link to comment
Share on other sites

To add to Mr Diaco's Great advice!

 

You can also check out this forum post which goes over using GSAP to animate the currentTime object of the <video> element:

 

http://greensock.com/forums/topic/12771-animating-the-playhead-of-video-element-is-it-possible/#entry53567

 

As long as you match the duration of the video with the tweens duration, then the tween will animate with the video correctly.

 

:)

  • Like 3
Link to comment
Share on other sites

  • 11 months later...
  • 11 months later...

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...