window.requestAnimationFrame() can play more nicely with others (e.g. maybe stopping when the window doesn't have focus, delaying when the CPU is overloaded and maybe other niceties that vary by browser) than setTimeout on modern browsers, at the cost of having to track time yourself.
function init() { ... for( ...) { var frameState = {idx: i, start: null, nextFrame: null} window.requestAnimationFrame(processOverlay.bind(frameState)) } }
function processOverlay(timestamp) { var idx = this.idx; if (!this.start) { this.start = timestamp; this.nextFrame = timestamp }
if (this.nextFrame > timestamp) { // Nothing to do this time. window.requestAnimationFrame(processOverlay.bind(this)); return }
Thanks! I was looking for something like that so I could improve the timing of sub animations. I have updated the code so now the blinking in panel 3 happens on its own timescale. I also added support for multiple sub animations and opacity changes, which I used to add random blushing to panel 3.
Sheik is already gender-swapped (disguised?) princess Zelda, so now we're swapping her back? Or keeping him male? Is he/she the top or bottom? I'm gonna need a flowchart here.
@Admin: I can't wait to see gender-swapped Link getting skull-fucked like this in a full-color comic version of this scene and hope you can get around to making it happen!!