Coder Social home page Coder Social logo

Comments (6)

davidedc avatar davidedc commented on May 29, 2024

can you point me at the line I'll take a look whether it's stale code

from livecodelab.

rumblesan avatar rumblesan commented on May 29, 2024

https://github.com/davidedc/livecodelab/blob/master/coffee/core/animation-loop.coffee#L103-121

It's basically all that code. We have the global shim being pulled in, and we never really have a reason not to use requestAnimationFrame and force using timeouts instead.

just feels like code that isn't really needed and could be removed

from livecodelab.

davidedc avatar davidedc commented on May 29, 2024

it is possible that this was experimental code and it's now stale, let me check with a clear head tomorrow

from livecodelab.

rumblesan avatar rumblesan commented on May 29, 2024

no worries, it's been in there pretty much as long as I can remember heh

from livecodelab.

davidedc avatar davidedc commented on May 29, 2024

oh, yes, you found it, that piece of code "caps" the framerate then, which might be useful to do, as the requestAnimationFrame normally fires "as fast as possible".

There must be a better way to cap the framerate though: by using the timeout and then invoking requestAnimationFrame, rather than how it's done here (using timeouts only).

The advantage of using requestAnimationFrame also in the "capped fps" scenario is that requestAnimationFrame is more efficient and consolidates several repaints together (say, the ones from codemirror and the ones from the canvas(es))...

from livecodelab.

rumblesan avatar rumblesan commented on May 29, 2024

so just having a look at this again. found this
http://creativejs.com/resources/requestanimationframe/
shows almost exactly the technique you thought up @davidedc
if we still care about setting the framerate then it would be good to implement

from livecodelab.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.