UNPKG

agentscript

Version:

AgentScript Model in Model/View architecture

39 lines (32 loc) 1.06 kB
<html> <head> <title>Water</title> </head> <body> <script type="module"> import Animator from '/src/Animator.js' import TwoDraw from '/src/TwoDraw.js' import Model from '/models/WaterModel.js' import TwoDrawOptions from '/views2mv/waterOptions.js' const patchSize = 2 const modelOptions = TwoDraw.fullScreenOptions(patchSize) const model = new Model(modelOptions) await model.startup() model.setup() const view = new TwoDraw( model, TwoDrawOptions('modelDiv', model, patchSize) ) view.setPatchesSmoothing(true) // make water smoother const anim = new Animator( () => { model.step() view.draw() }, 500, // how many steps 30 // at fps steps/second ) </script> <div id="modelDiv"></div> </body> </html>