locked-joints-reverse-rotate.js

total 0
used 0
limit 0
/* --- title: Locked Joint files: ../point_src/core/head.js ../point_src/pointpen.js ../point_src/pointdraw.js ../point_src/pointlist.js ../point_src/point-content.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/constrain-distance.js --- Same as locked-joint but when you move the knee joint, the hip rotates. Assigning a `resist` of `0` (default: `1`), allows the parent point to be rotated around its center. If the resist value was `.5`, it would rotate 50% of the pull distance of the target knee, and the knee reciprocates with 50% damping on its position. */ class MainStage extends Stage { canvas='playspace' mounted(){ let a = this.a = new Point({x:200,y:200, radius: 50, rotation: 10, cone: 50 }) let b = this.b = new Point({x:400,y:200, radius: 30, rotation: 0, /* degrees either side of rotation point. resulting in 10 arc degress allowed movement.*/ cone: 10}) // let c = this.c = new Point({x:600,y:200, radius: 20}) this.dragging.add(a, b) } draw(ctx){ this.clear(ctx) // this.a.rotation += 1 /* resist=0 means the parent absorbs the overflow and rotates with the dragged knee instead of forcing the knee back to the cone edge. */ this.a.constraint.cone(this.b, this.a.cone, { resist: 0.5}) this.b.constraint.track(this.a, 200) this.a.pen.indicator(ctx, {color:'#ddd'}) this.b.pen.indicator(ctx, {color:'green'}) } } ;stage = MainStage.go();
Run
Meta Data
title Locked Joint
imports ()
files ('../point_src/core/head.js', '../point_src/pointpen.js', '../point_src/pointdraw.js', '../point_src/pointlist.js', '../point_src/point-content.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/constrain-distance.js')
unused_keys ()
unknown_keys ()
filepath_exists True
path locked-joints-reverse-rotate.js
filepath locked-joints-reverse-rotate.js
clean_files ('../point_src/core/head.js', '../point_src/pointpen.js', '../point_src/pointdraw.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/compass.js', '../point_src/center.js', '../point_src/point-content.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-hooks.js', '../point_src/functions/resolve.js', '../point_src/stage.js', '../point_src/constrain-distance.js')
markdown {'html': '<p>Same as locked-joint but when you move the knee joint, the hip rotates.\nAssigning a <code>resist</code> of <code>0</code> (default: <code>1</code>), allows the parent point to\nbe rotated around its center.</p>\n<p>If the resist value was <code>.5</code>, it would rotate\n50% of the pull distance of the target knee, and the knee reciprocates with 50%\ndamping on its position.</p>', 'content': '---\ntitle: Locked Joint\nfiles:\n ../point_src/core/head.js\n ../point_src/pointpen.js\n ../point_src/pointdraw.js\n ../point_src/pointlist.js\n ../point_src/point-content.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/constrain-distance.js\n---\n\nSame as locked-joint but when you move the knee joint, the hip rotates.\nAssigning a `resist` of `0` (default: `1`), allows the parent point to\nbe rotated around its center.\n\nIf the resist value was `.5`, it would rotate\n50% of the pull distance of the target knee, and the knee reciprocates with 50%\ndamping on its position.'}