coupling-points.js

total 0
used 0
limit 0
/* --- title: Coupling Points categories: binding files: ../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/automouse.js ../point_src/distances.js ../point_src/dragging.js ../point_src/functions/clamp.js ../point_src/stage.js ../point_src/coupling.js --- # Coupling Three Points assign multiple _coupled_ keys across three points. Dragging a point adapts its sibling. */ class MainStage extends Stage { canvas='playspace' mounted(){ let a = this.a = new Point({x:200,y:200, radius: 50}) let b = this.b = new Point({x:300,y:300, radius: 50}) let c = this.c = new Point({x:200,y:200, radius: 50}) this.dragging.add(a, b, c) let d = this.coupling = new Coupling() d.couple(a, b, { x: 100 // , y: 100 }) d.couple(a, b, { // x: 100 rotation: 10 , radius: 0 // y: 100 }) d.couple(a, c, { y: 100 , rotation: -180 // y: 100 }); d.step() } draw(ctx){ this.clear(ctx) this.a.rotation += 1 this.coupling.step() this.a.pen.indicator(ctx, { color:'#ddd'}) this.b.pen.indicator(ctx, {color:'green'}) this.c.pen.indicator(ctx) } } ;stage = MainStage.go();
Run
Meta Data
title Coupling Points
imports ()
files ('../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/automouse.js', '../point_src/distances.js', '../point_src/dragging.js', '../point_src/functions/clamp.js', '../point_src/stage.js', '../point_src/coupling.js')
unused_keys ()
unknown_keys ('categories',)
categories ['binding']
filepath_exists True
path coupling-points.js
filepath coupling-points.js
clean_files ('../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/automouse.js', '../point_src/distances.js', '../point_src/protractor.js', '../point_src/text/beta.js', '../point_src/dragging.js', '../point_src/functions/clamp.js', '../point_src/stage-resize.js', '../point_src/functions/resolve.js', '../point_src/stage.js', '../point_src/coupling.js')
markdown {'html': '<h1>Coupling Three Points</h1>\n<p>assign multiple <em>coupled</em> keys across three points. Dragging a point adapts its\nsibling.</p>', 'content': '---\ntitle: Coupling Points\ncategories: binding\nfiles:\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/automouse.js\n ../point_src/distances.js\n ../point_src/dragging.js\n ../point_src/functions/clamp.js\n ../point_src/stage.js\n ../point_src/coupling.js\n---\n\n# Coupling Three Points\n\nassign multiple _coupled_ keys across three points. Dragging a point adapts its\nsibling.'}