tungs / timecut

Node.js program to record smooth movies of web pages with JavaScript animations

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[FEATURE REQUEST] Support for Declarative (SMIL) Animation

christianhujer opened this issue · comments

When recording a declarative (SMIL) animation, the animation speed in the recorded video does not match the animation speed in the actual SVG file.

Hi @christianhujer, unfortunately due to its implementation, timecut/timesnap does not support SVG animations-- it only aims to support JavaScript and (some) video.

I guessed so. Maybe we can keep this ticket open as a feature request? I understand that upstream changes may be required, even as far as to Chromium itself.

This project primarily uses only JavaScript and Puppeteer for time handling, so changes to Chromium would probably be outside of the scope.

That said, it's not completely out of the question to make a JavaScript implementation of SMIL. In fact, a quick search shows that there's a JavaScript polyfill for SMIL at https://github.com/ericwilligers/svg-animation, which might work for you (though it might require some work to force an overwrite with browsers that already support it and disabling native SMIL support).

See Also:
https://bugs.chromium.org/p/chromium/issues/detail?id=498081 (maybe using --disable-blink-feature=smil to disable native SMIL handling)

I'm not a web developer, so I might be entirely wrong here, but it appears that SVGs have a couple methods that can help:

  • pauseAnimations() can stop the animation;
  • setCurrentTime() can move the animation to the desired point in time, in seconds.

Can't they be used to pause the animation and then advance it along with the "virtual time" in which all other elements live?

Thanks @Minoru for the information; I wasn't aware of these methods. This does make SVG Animations look a lot more promising. I'll take a look into this when I have some time.