plotter-raw.js

total 0
used 0
limit 0
/* title: Plotter files: head point stage dragging pointlist mouse stroke --- Plotting captures the XY RAD ROT of a point upon request, and stashes it in a pointlist. This is useful for timestep captures such as spline walks. */ class MainStage extends Stage { // canvas = document.getElementById('playspace'); canvas = 'playspace' mounted(){ // this.dragging.add(...this.points) // this.events.wake() this.points = new PointList; } maxDistance = 50 projectionSpread = .3 minSpeed = 20 onMousedown(ev) { let delta = Infinity if(this.mouseUpTime) { delta = +(new Date) - this.mouseUpTime } if(delta < 100) { /* mouse click buffer */ console.warn('fast click') } // console.log('start draw', delta) clearInterval(this.walkTicker) this.walkTicker = undefined this.drawingLine = true this.startLine(Point.from(ev)) } onMouseup(ev) { // console.log('stop draw') this.drawingLine = false this.stopLine(Point.from(ev)) this.mouseUpTime = +(new Date) } onMousemove(ev) { if(this.drawingLine) { this.tickFunc() } } startLine(point) { /* Start a line at a position*/ this.line = new PointList(point) this.walkTicker = setInterval(this.tickFunc.bind(this), 50) } stopLine(point) { this.line.push(point) clearInterval(this.walkTicker) this.walkTicker = undefined } tickFunc() { /* Tick event, if the distance is greater than the existing, add point.*/ let mp = this.mouse.point let l = this.points let last = l.last() let perform = true; if(last) { last.lookAt(mp) if(mp.distanceTo(last) < this.maxDistance) { perform = false; } } if(perform){ l.push(mp.copy()) } } draw(ctx){ this.clear(ctx) this.points.pen.indicator(ctx, {color: '#555'}) } } stage = MainStage.go()
Run
Meta Data
title Plotter
imports ()
files ('head', 'point', 'stage', 'dragging', 'pointlist', 'mouse', 'stroke')
unused_keys ()
unknown_keys ()
filepath_exists True
path plotter-raw.js
filepath plotter-raw.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/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/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/setunset.js', '../point_src/stroke.js')
markdown {'html': '<p>Plotting captures the XY RAD ROT of a point upon request, and stashes it in a\npointlist. This is useful for timestep captures such as spline walks.</p>', 'content': 'title: Plotter\nfiles:\n head\n point\n stage\n dragging\n pointlist\n mouse\n stroke\n---\n\nPlotting captures the XY RAD ROT of a point upon request, and stashes it in a\npointlist. This is useful for timestep captures such as spline walks.'}