lines-multi-examples.js

total 0
used 0
limit 0
/* categories: lines curve files: ../point_src/core/head.js ../point_src/pointpen.js ../point_src/pointdraw.js ../point_src/math.js ../point_src/point-content.js pointlist ../point_src/point.js mouse dragging ../point_src/setunset.js ../point_src/stroke.js ../point_src/stage.js # ../others/curve_src/curve.js # ../point_src/line.js # ../point_src/extras.js ../point_src/catenary-curve.js ../point_src/curve-extras.js */ var superV = 0 class MainStage extends Stage { canvas = 'playspace' mounted(){ this.points = this.pointPair() this.linePoints = this.pointPair() this.curvePoints = this.pointPair(150) this.cantenaryPoints = this.pointPair(300) this.line = new Line(...this.linePoints, 'green', 2) /*this.line = new Line(...this.points, 'green', 2)*/ this.curvyLine = new BezierCurve(...this.curvePoints) this.cantenary = this.setupCantenary(this.cantenaryPoints) /* this.cantenary = this.setupCantenary(this.pointPair(40)) */ this.tick = 0 this.setupDragging() } setupCantenary(points) { let c = new CantenaryCurve(...points) // this.cantenary.sine = 30 c.restLength = 430 c.bounceRate = .08 c.reductionRate = .999 c.swingDegrees = 20 c.elasticity = .09 return c } setupDragging() { this.dis = new Dragging this.dis.initDragging(this) // this.dis.onDragMove = this.onDragMove.bind(this) // this.dis.onDragEnd = this.onDragEnd.bind(this) this.dis.addPoints( ...this.linePoints , ...this.curvePoints , ...this.cantenaryPoints ) } pointPair(yOffset=0) { let cumX = 0 , cumOffset = 200 , globalY = 100 , offset = ()=> cumX+=cumOffset , c = this.compass ; let ps = new PointList( new Point({ name: "a" , rotation: c.right , x: offset() , y: globalY + yOffset , radius: 60 }) , new Point({ name: "b" , rotation: c.left // RIGHT_DEG , x: offset() , y: globalY + 50 + yOffset , radius: 70 }) ) return ps; } draw(ctx){ this.clear(ctx) this.line.render(ctx) this.drawCantenary(ctx) this.curvyLine.points.pen.indicators(ctx, {line: {color: '#999', width: 1}}) this.curvyLine.render(ctx, {width: 3, color: '#990088'}) let p = this.dis.getPoint(); if(p) { p.pen.circle(ctx) } this.tick += 1 } drawCantenary(ctx) { let cantenary = this.cantenary; cantenary.render(ctx) let tick = this.tick if(tick % 1 == 0) { cantenary.update(ctx, tick) cantenary.updateSwing(ctx, tick) } } } stage = MainStage.go(/*{ loop: true }*/)
Run
Meta Data
imports ()
files ('../point_src/core/head.js', '../point_src/pointpen.js', '../point_src/pointdraw.js', '../point_src/math.js', '../point_src/point-content.js', 'pointlist', '../point_src/point.js', 'mouse', 'dragging', '../point_src/setunset.js', '../point_src/stroke.js', '../point_src/stage.js', '# ../others/curve_src/curve.js', '# ../point_src/line.js', '# ../point_src/extras.js', '../point_src/catenary-curve.js', '../point_src/curve-extras.js')
unused_keys ('title',)
unknown_keys ('categories',)
categories ['lines', 'curve']
filepath_exists True
path lines-multi-examples.js
filepath lines-multi-examples.js
clean_files ('../point_src/core/head.js', '../point_src/pointpen.js', '../point_src/pointdraw.js', '../point_src/math.js', '../point_src/compass.js', '../point_src/center.js', '../point_src/point-content.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/relative-xy.js', '../point_src/pointcast.js', '../point_src/point.js', '../point_src/events.js', '../point_src/automouse.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/stage-resize.js', '../point_src/functions/resolve.js', '../point_src/stage.js', '../point_src/catenary-curve.js', '../point_src/curve-extras.js')
markdown {'html': '', 'content': 'categories: lines\n curve\nfiles:\n ../point_src/core/head.js\n ../point_src/pointpen.js\n ../point_src/pointdraw.js\n ../point_src/math.js\n ../point_src/point-content.js\n pointlist\n ../point_src/point.js\n mouse\n dragging\n ../point_src/setunset.js\n ../point_src/stroke.js\n ../point_src/stage.js\n # ../others/curve_src/curve.js\n # ../point_src/line.js\n # ../point_src/extras.js\n ../point_src/catenary-curve.js\n ../point_src/curve-extras.js'}