agentscript
Version:
AgentScript Model in Model/View architecture
33 lines (28 loc) • 921 B
HTML
<html>
<head>
<title>Hello</title>
</head>
<body>
<script type="module">
import Animator from 'https://agentscript.org/src/Animator.js'
import TwoDraw from 'https://agentscript.org/src/TwoDraw.js'
import Model from 'https://agentscript.org/models/HelloModel.js'
const model = new Model() // use model's default world options
model.setup()
const view = new TwoDraw(model, {
div: 'modelDiv',
patchSize: 20,
drawOptions: { turtlesSize: 1.5 },
})
const anim = new Animator(
() => {
model.step()
view.draw()
},
500, // how many steps
30 // at fps steps/second
)
</script>
<div id="modelDiv"></div>
</body>
</html>