Esri / wind-js

An demo animation of wind on a Canvas layer in the JSAPI
MIT License
735 stars 214 forks source link

Two concurent loops during animation #16

Closed ilblog closed 9 years ago

ilblog commented 9 years ago

Hi

I am not sure about the frame() fun at the end of code. It seems to me, that you use your own timer and rqstanimationframe at the same time. It seems to me that you use two timers concurentlly. But I am not expert. If this is not intent I can correct it.

(function frame() {
    try {
        windy.timer = setTimeout(function() {
          requestAnimationFrame(frame);
          evolve();
          draw();
        }, 1000 / FRAME_RATE);
    }
    catch (e) {
        console.error(e);
    }
ilblog commented 9 years ago

My mistake, your solution is correct