UNPKG

agentscript

Version:

AgentScript Model in Model/View architecture

49 lines (42 loc) 1.42 kB
<html> <head> <title>shapes3d</title> <link rel="icon" type="image/x-icon" href="../favicon.ico" /> </head> <body> <script type="module"> import * as util from '../src/utils.js' import ThreeDraw from '../src/ThreeDraw.js' import Model from '../models/Hello3DModel.js' const drawOptions = { // turtlesShape: 'random', turtlesShape: t => ThreeDraw.shapeNames().atIndex(t.id), turtlesColor: 'random', turtlesSize: 2.5, } async function run() { const model = new Model() model.linksToo = false await model.startup() model.setup() const view = new ThreeDraw(model, { div: 'modelDiv', turtles: { meshClass: 'Obj3DMesh', useAxes: true }, drawOptions, }) util.toWindow({ util, model, view, ThreeDraw }) await util.timeoutLoop( () => { model.step() view.draw() }, -1, //500, 0 //33 ) view.idle() } run() </script> <div id="modelDiv"></div> </body> </html>