random-example.js

total 0
used 0
limit 0
/* title: Tethered Controller Point categories: binding files: head point pointlist mouse stage dragging stroke ../point_src/random.js ../point_src/distances.js ../point_src/functions/range.js ../point_src/tethers.js ../point_src/stage-clock.js --- */ addButton('Add Random',{ onclick(){ range(100).forEach(()=>{ stage.addNewPoint() }) } }) addButton('Add Guassian',{ onclick(){ // stage.addNewPoint() range(100).forEach(()=>{ stage.addGaussianNewPoint() }) } }) class MainStage extends Stage { canvas='playspace' mounted(){ this.point = this.center.copy().update({radius: 100}) this.points = new PointList() this.dragging.add(this.point) this.addGaussianNewPoint() this.addGaussianNewPoint() } addNewPoint() { let p = new Point(random.within(this.point, .5)) p.radius = 3 this.points.push(p) // this.dragging.add(p) } addGaussianNewPoint() { let r = this.point.radius let p = this.point.copy().update({radius: 3}) p.x += random.gaussian(0, r*.5, 0, .5) p.y += random.gaussian(0, r*.5, 0, .5) this.points.push(p) // this.dragging.add(p) } draw(ctx){ this.clear(ctx) let p = this.point p.pen.indicator(ctx, {color: '#336600'}) this.points.pen.fill(ctx, {color: '#336600'}) } } ;stage = MainStage.go();
Run
Meta Data
title Tethered Controller Point
imports ()
files ('head', 'point', 'pointlist', 'mouse', 'stage', 'dragging', 'stroke', '../point_src/random.js', '../point_src/distances.js', '../point_src/functions/range.js', '../point_src/tethers.js', '../point_src/stage-clock.js')
unused_keys ()
unknown_keys ('categories',)
categories ['binding']
filepath_exists True
path random-example.js
filepath random-example.js
clean_files ('../point_src/core/head.js', '../point_src/pointpen.js', '../point_src/compass.js', '../point_src/center.js', '../point_src/point-content.js', '../point_src/pointdraw.js', '../point_src/relative-xy.js', '../point_src/pointcast.js', '../point_src/point.js', '../point_src/pointlistdraw.js', '../point_src/pointlistgradient.js', '../point_src/pointlistshape.js', '../point_src/pointlistgenerator.js', '../point_src/unpack.js', '../point_src/pointlist.js', '../point_src/pointlistpen.js', '../point_src/events.js', '../point_src/automouse.js', '../point_src/stage-resize.js', '../point_src/functions/resolve.js', '../point_src/stage.js', '../point_src/functions/clamp.js', '../point_src/distances.js', '../point_src/protractor.js', '../point_src/text/beta.js', '../point_src/dragging.js', '../point_src/setunset.js', '../point_src/stroke.js', '../point_src/random.js', '../point_src/functions/range.js', '../point_src/./windings.js', '../point_src/tethers.js', '../point_src/stage-clock.js')
markdown {'html': '', 'content': 'title: Tethered Controller Point\ncategories: binding\nfiles:\n head\n point\n pointlist\n mouse\n stage\n dragging\n stroke\n ../point_src/random.js\n ../point_src/distances.js\n ../point_src/functions/range.js\n ../point_src/tethers.js\n ../point_src/stage-clock.js\n---'}