UNPKG

agentscript

Version:

AgentScript Model in Model/View architecture

38 lines (32 loc) 966 B
<html> <head> <title>Template</title> </head> <body> <script type="module"> import Animator from "https://code.agentscript.org/src/Animator.js" import TwoDraw from "https://code.agentscript.org/src/TwoDraw.js" import Model from "https://code.agentscript.org/models/TemplateModel.js" const model = new Model() model.setup() const drawOptions = { turtlesColor: 'yellow', turtlesSize: 3, turtlesShape: 'bug', linksColor: 'red', linksWidth: 3, // patchesMap: 'Jet', } const view = new TwoDraw(model, { div: 'modelDiv', patchSize: 20, drawOptions }) const anim = new Animator( () => { model.step() view.draw() }, 500, // run for 500 steps 30 // at 30 steps/second ) </script> <div id="modelDiv"></div> </body> </html>