jiggle-plain.js

total 0
used 0
limit 0
/* --- title: Jiggle categories: iteration files: ../point_src/core/head.js ../point_src/pointpen.js ../point_src/pointdraw.js ../point_src/extras.js ../point_src/math.js ../point_src/point-content.js ../point_src/stage.js ../point_src/point.js ../point_src/distances.js ../point_src/pointlist.js ../point_src/events.js ../point_src/functions/clamp.js ../point_src/relative.js ../point_src/keyboard.js ../point_src/automouse.js ../point_src/dragging.js ../point_src/iter/alpha.js ../point_src/text/alpha.js ../point_src/text/label.js ../point_src/text/beta.js ../point_src/jiggle.js --- Speedy motion at a singular position. https://youtube.com/clip/UgkxbshWOsMf_ukuMO-Zq9Mimj1UYlFDIQ9Q?si=RgotghYr0We685BC */ class MainStage extends Stage { canvas='playspace' mounted(){ this.a = this.center.copy().update({radius: 20}) this.lockPoint = this.center.copy().update({radius: 20}) this.dragging.addPoints(this.lockPoint) // this.iter = new Iter(1, 4, 20) this.ticker = 0 this.jiggleOptions = { /* defaults */ speedReducer: .2 , xSpeed: .7 , ySpeed: .5 , width: 3 , height: 3 , tick: 1 } } getJiggle(lock=this.lockPoint, settings) { const o = Object.assign(this.jiggleOptions, settings) let xO = Math.cos(o.tick * (o.speedReducer * o.xSpeed)) let yO = Math.sin(o.tick * (o.speedReducer * o.ySpeed)) return { x: lock.x + (xO * o.width) , y: lock.y + (yO * o.height) } } draw(ctx){ this.clear(ctx) let tick = this.ticker += 1 const a = this.a let speedReducer = (20 / this.mouse.point.distanceTo(this.lockPoint)) speedReducer = clamp(speedReducer, .1, 1) let width = clamp(speedReducer * 10, 1, 3) let height = clamp(speedReducer * 10, 1, 3) a.radius = this.lockPoint.radius a.update(this.getJiggle(this.lockPoint, { tick, width, height })) this.lockPoint.text.value = width.toFixed(2) a.pen.fill(ctx, '#22BB55') ctx.fillStyle = '#000' this.lockPoint.text.fill(ctx) } } ;stage = MainStage.go();
Run
Meta Data
title Jiggle
imports ()
files ('../point_src/core/head.js', '../point_src/pointpen.js', '../point_src/pointdraw.js', '../point_src/extras.js', '../point_src/math.js', '../point_src/point-content.js', '../point_src/stage.js', '../point_src/point.js', '../point_src/distances.js', '../point_src/pointlist.js', '../point_src/events.js', '../point_src/functions/clamp.js', '../point_src/relative.js', '../point_src/keyboard.js', '../point_src/automouse.js', '../point_src/dragging.js', '../point_src/iter/alpha.js', '../point_src/text/alpha.js', '../point_src/text/label.js', '../point_src/text/beta.js', '../point_src/jiggle.js')
unused_keys ()
unknown_keys ('categories',)
categories ['iteration']
filepath_exists True
path jiggle-plain.js
filepath jiggle-plain.js
clean_files ('../point_src/core/head.js', '../point_src/pointpen.js', '../point_src/pointdraw.js', '../point_src/extras.js', '../point_src/math.js', '../point_src/compass.js', '../point_src/center.js', '../point_src/point-content.js', '../point_src/stage-resize.js', '../point_src/functions/resolve.js', '../point_src/stage.js', '../point_src/relative-xy.js', '../point_src/pointcast.js', '../point_src/point.js', '../point_src/distances.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/events.js', '../point_src/functions/clamp.js', '../point_src/relative.js', '../point_src/keyboard.js', '../point_src/automouse.js', '../point_src/protractor.js', '../point_src/text/beta.js', '../point_src/dragging.js', '../point_src/iter/alpha.js', '../point_src/text/alpha.js', '../point_src/text/label.js', '../point_src/jiggle.js')
markdown {'html': '<hr />\n<p>Speedy motion at a singular position.\nhttps://youtube.com/clip/UgkxbshWOsMf_ukuMO-Zq9Mimj1UYlFDIQ9Q?si=RgotghYr0We685BC</p>', 'content': '---\ntitle: Jiggle\ncategories: iteration\nfiles:\n ../point_src/core/head.js\n ../point_src/pointpen.js\n ../point_src/pointdraw.js\n ../point_src/extras.js\n ../point_src/math.js\n ../point_src/point-content.js\n ../point_src/stage.js\n ../point_src/point.js\n ../point_src/distances.js\n ../point_src/pointlist.js\n ../point_src/events.js\n ../point_src/functions/clamp.js\n ../point_src/relative.js\n ../point_src/keyboard.js\n ../point_src/automouse.js\n ../point_src/dragging.js\n ../point_src/iter/alpha.js\n ../point_src/text/alpha.js\n ../point_src/text/label.js\n ../point_src/text/beta.js\n ../point_src/jiggle.js\n\n---\n\nSpeedy motion at a singular position.\nhttps://youtube.com/clip/UgkxbshWOsMf_ukuMO-Zq9Mimj1UYlFDIQ9Q?si=RgotghYr0We685BC'}