balloon-3.js

total 0
used 0
limit 0
/* title: Better Balloon categories: chain rope constraints files: head pointlist point stage stroke mouse ../point_src/collisionbox.js dragging ../point_src/random.js ../point_src/rope.js ../theatre/objects/balloon.js --- The _other_ balloon example uses one rope with negative gravity. In this version there are two ropes. One (hidden) rope connecting the balloon and the pin, and a second (rendered) rope, with the two pinned ends matching the balloon rope - with _correct_ gravity. */ // const distance = 5; // const gravity2D = {x:0, y:8.9}; // const gravity = 0.35; // const friction = 0.9; class MainStage extends Stage { canvas='playspace' mounted(){ this.balloon = new Balloon({ // gravity: .3 // invMass: -13 color: '#44BB22' , knotColor: '#229900' , ropeColor: '#aaa' , position: this.center.copy() }) // this.balloon.mounted(this.center.copy()) this.balloon2 = new Balloon() this.balloon2.mounted(this.center.copy().add(50)) this.balloon3 = new Balloon() this.balloon3.mounted(this.center.copy().add(-50)) this.collisionBox = new CollisionBox([ this.balloon.head , this.balloon2.head , this.balloon3.head ]) this.dragging.add( this.balloon.handle , this.balloon2.handle , this.balloon3.handle // , this.points2[0] // , lastPoint ) } draw(ctx) { this.clear(ctx); ctx.fillStyle = '#999' ctx.font = 'normal 30px lexend deca' ctx.textAlign = 'center' this.collisionBox.shuffle() this.balloon.draw(ctx) this.balloon2.draw(ctx) this.balloon3.draw(ctx) } } ;stage = MainStage.go();
Run
Meta Data
title Better Balloon
imports ()
files ('head', 'pointlist', 'point', 'stage', 'stroke', 'mouse', '../point_src/collisionbox.js', 'dragging', '../point_src/random.js', '../point_src/rope.js', '../theatre/objects/balloon.js')
unused_keys ()
unknown_keys ('categories',)
categories ['chain', 'rope', 'constraints']
filepath_exists True
path balloon-3.js
filepath balloon-3.js
clean_files ('../point_src/core/head.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/pointpen.js', '../point_src/compass.js', '../point_src/center.js', '../point_src/point-content.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/setunset.js', '../point_src/stroke.js', '../point_src/events.js', '../point_src/automouse.js', '../point_src/collisionbox.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/random.js', '../point_src/rope.js', '../theatre/objects/balloon.js')
markdown {'html': '<hr />\n<p>The <em>other</em> balloon example uses one rope with negative gravity.</p>\n<p>In this version there are two ropes. One (hidden) rope connecting the balloon\nand the pin, and a second (rendered) rope, with the two pinned ends matching\nthe balloon rope - with <em>correct</em> gravity.</p>', 'content': 'title: Better Balloon\ncategories: chain\n rope\n constraints\nfiles:\n head\n pointlist\n point\n stage\n stroke\n mouse\n ../point_src/collisionbox.js\n dragging\n ../point_src/random.js\n ../point_src/rope.js\n ../theatre/objects/balloon.js\n\n---\n\nThe _other_ balloon example uses one rope with negative gravity.\n\nIn this version there are two ropes. One (hidden) rope connecting the balloon\nand the pin, and a second (rendered) rope, with the two pinned ends matching\nthe balloon rope - with _correct_ gravity.'}