tungs / timesnap

Node.js program that takes screenshots at smooth intervals of web pages with JavaScript animations
BSD 3-Clause "New" or "Revised" License
234 stars 57 forks source link

shouldSkipFrame too slow #45

Closed soulblvd closed 2 years ago

soulblvd commented 4 years ago

this happens when the webpage contains videos or webgl animations, it takes lot of times to skip thousands of frames, is it possible to speed it up? thank you for this feature, really helpful.

tungs commented 3 years ago

Apologies for the late response-- there is config.start that allows you to specify a virtual start time that should skip processing many of the frames at the beginning that animate using requestAnimationFrame. If you're using setTimeout or setInterval, unfortunately there's no way to skip those, since timesnap doesn't know which functions can be delayed.

Using shouldSkipFrame still goes to the virtual time itself and runs animation frames-- a more accurate name would be shouldSkipFrameCapture. It might be a useful feature to skip running animation frames, but so far there hasn't seemed to be that much of an interest in it. Let me know if you're looking for something more sophisticated than skipping frames at the beginning using config.start.