lookat-multiplier.js

total 0
used 0
limit 0
/* files: ../point_src/math.js ../point_src/core/head.js ../point_src/pointpen.js ../point_src/pointdraw.js ../point_src/point-content.js ../point_src/pointlist.js ../point_src/point.js ../point_src/events.js ../point_src/stage.js ../point_src/distances.js ../point_src/automouse.js ../point_src/extras.js --- The `turnTo` method acts very similar to the `lookAt` method, but accepts a speed to denote _how quickly_ the origin point should turn to the target. const origin = new Point(200, 200, 20) // between 0 and 1 origin.turnTo(Point.mouse.poition, .01) */ const drawView = function(ctx, lookerPoint){ /* Project to the distance of the mouse. */ const projectedPoint = lookerPoint.project() /* Draw from the projected point back to the origin. */ projectedPoint.pen.line(ctx, lookerPoint, 'red') projectedPoint.pen.circle(ctx, {color: 'red'}) } class MainStage extends Stage { // canvas = document.getElementById('playspace'); canvas = 'playspace' mounted(){ this.pointA = this.center.copy().update({ radius: 100 }) this.pointB = this.pointA.copy() this.pointC = this.pointA.copy() } draw(ctx){ this.clear(ctx) let targetPosition = Point.mouse.position this.pointA.turnTo(targetPosition, .01) this.pointB.turnTo(targetPosition, 1) this.pointC.turnTo(targetPosition, .001) drawView(ctx, this.pointA) drawView(ctx, this.pointB) drawView(ctx, this.pointC) } } stage = MainStage.go(/*{ loop: true }*/)
Run
Meta Data
imports ()
files ('../point_src/math.js', '../point_src/core/head.js', '../point_src/pointpen.js', '../point_src/pointdraw.js', '../point_src/point-content.js', '../point_src/pointlist.js', '../point_src/point.js', '../point_src/events.js', '../point_src/stage.js', '../point_src/distances.js', '../point_src/automouse.js', '../point_src/extras.js')
unused_keys ('title',)
unknown_keys ()
filepath_exists True
path lookat-multiplier.js
filepath lookat-multiplier.js
clean_files ('../point_src/math.js', '../point_src/core/head.js', '../point_src/pointpen.js', '../point_src/pointdraw.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/relative-xy.js', '../point_src/pointcast.js', '../point_src/point.js', '../point_src/events.js', '../point_src/stage-resize.js', '../point_src/functions/resolve.js', '../point_src/stage.js', '../point_src/distances.js', '../point_src/automouse.js', '../point_src/extras.js')
markdown {'html': '<p>The <code>turnTo</code> method acts very similar to the <code>lookAt</code> method, but accepts a\nspeed to denote <em>how quickly</em> the origin point should turn to the target.</p>\n<pre><code>const origin = new Point(200, 200, 20)\n// between 0 and 1\norigin.turnTo(Point.mouse.poition, .01)\n</code></pre>', 'content': 'files:\n ../point_src/math.js\n ../point_src/core/head.js\n ../point_src/pointpen.js\n ../point_src/pointdraw.js\n ../point_src/point-content.js\n ../point_src/pointlist.js\n ../point_src/point.js\n ../point_src/events.js\n ../point_src/stage.js\n ../point_src/distances.js\n ../point_src/automouse.js\n ../point_src/extras.js\n---\n\nThe `turnTo` method acts very similar to the `lookAt` method, but accepts a\nspeed to denote _how quickly_ the origin point should turn to the target.\n\n const origin = new Point(200, 200, 20)\n // between 0 and 1\n origin.turnTo(Point.mouse.poition, .01)'}