follow-and-constrain-point.js

total 0
used 0
limit 0
/* title: Point Follow And Constrain categories: constraints files: ../point_src/core/head.js ../point_src/math.js ../point_src/extras.js ../point_src/point-content.js ../point_src/pointlist.js point stage ../point_src/events.js ../point_src/automouse.js ../point_src/distances.js ../point_src/functions/clamp.js ../point_src/constrain-distance-locked.js ../point_src/constrain-distance.js --- Follow the mouse position with `track`, `avoid`, and `leash` */ class MainStage extends Stage { // canvas = document.getElementById('playspace'); canvas = 'playspace' mounted(){ this.size = 150 this.orbitPoint = new Point({ x: 250, y: 150 , radius: 10 }) this.innerPoint = new Point({ radius: 20 }) this.orbitPet = new Point() this.outerPoint = new Point({ x: 400, y: 320 , radius: 20 }) } draw(ctx){ this.clear(ctx) ctx.fillStyle = 'green' ctx.strokeStyle = 'yellow' let mouse = Point.mouse let mp = mouse.position let size = mouse.clampWheelSize(5, 20) let r = size * size mp.radius = r this.orbitPoint.track(mp, r) this.orbitPet.track(this.orbitPoint, 50) this.outerPoint.avoid(mp, r + this.outerPoint.radius) this.innerPoint.leash(mp, r - this.innerPoint.radius) mp.pen.circle(ctx) this.orbitPoint.pen.fill(ctx) this.innerPoint.pen.circle(ctx) this.orbitPet.pen.circle(ctx) this.outerPoint.pen.fill(ctx) } } stage = MainStage.go(/*{ loop: true }*/)
Run
Meta Data
title Point Follow And Constrain
imports ()
files ('../point_src/core/head.js', '../point_src/math.js', '../point_src/extras.js', '../point_src/point-content.js', '../point_src/pointlist.js', 'point', 'stage', '../point_src/events.js', '../point_src/automouse.js', '../point_src/distances.js', '../point_src/functions/clamp.js', '../point_src/constrain-distance-locked.js', '../point_src/constrain-distance.js')
unused_keys ()
unknown_keys ('categories',)
categories ['constraints']
filepath_exists True
path follow-and-constrain-point.js
filepath follow-and-constrain-point.js
clean_files ('../point_src/core/head.js', '../point_src/math.js', '../point_src/extras.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/pointpen.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/events.js', '../point_src/automouse.js', '../point_src/distances.js', '../point_src/functions/clamp.js', '../point_src/constrain-distance-locked.js', '../point_src/constrain-distance.js')
markdown {'html': '<p>Follow the mouse position with <code>track</code>, <code>avoid</code>, and <code>leash</code></p>', 'content': 'title: Point Follow And Constrain\ncategories: constraints\nfiles:\n ../point_src/core/head.js\n ../point_src/math.js\n ../point_src/extras.js\n ../point_src/point-content.js\n ../point_src/pointlist.js\n point\n stage\n ../point_src/events.js\n ../point_src/automouse.js\n ../point_src/distances.js\n ../point_src/functions/clamp.js\n ../point_src/constrain-distance-locked.js\n ../point_src/constrain-distance.js\n---\n\nFollow the mouse position with `track`, `avoid`, and `leash`'}