UNPKG

agentscript

Version:

AgentScript Model in Model/View architecture

36 lines (30 loc) 946 B
<html> <head> <title>HelloText</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/HelloModel.js' const model = new Model() model.setup() const drawOptions = { turtlesShape: 'circle', turtlesSize: 2, // turtle size in patches textProperty: 'id', textSize: 0.8, // text size in patches } const view = new TwoDraw(model, { div: 'modelDiv', patchSize: 20, drawOptions }) const anim = new Animator( () => { model.step() view.draw() }, 500, // how many steps 30 // at fps steps/second ) </script> <div id="modelDiv"></div> </body> </html>