charlieroberts / marching

A JavaScript library that compiles GLSL ray marchers.
MIT License
208 stars 13 forks source link

Using Marching.js as the renderer for a js/html website/app? #19

Open drawtheliner opened 3 months ago

drawtheliner commented 3 months ago

I'd like to use the library as a renderer in web projects, such as websites, apps and games. However I'm not sure how to set this up.

In my js/html projects, I usually have a setup function, and then a function triggered by requestAnimationFrame, which deals with the app/game logic, and updating the scene based on the passage of time and user input.

However in marching.js it seems animation is handled differently. Is it possible to use it for the purposes I described, or is marching.js exclusively meant to be used for live coding?

charlieroberts commented 3 months ago

no, that will work fine. take a look at the demo.html file. then make sure you’re using a render preset that supports animation, and you can change whatever you like in your callback.