lerp-pointlist-value-only.js

total 0
used 0
limit 0
/* title: Raw PointList Lerping categories: lerp files: head pointlist point stage mouse ../point_src/random.js ../point_src/easing.js ../point_src/iter/lerp.js --- Lerp points C without affecting points A or B, using a single `Value()` instance. */ class MainStage extends Stage { canvas='playspace' mounted(){ let count = 50 // this.a = PointList.generate.grid(count, 10, 20, new Point(200, 200)) this.a = PointList.generate.random(count, [200,350, 10, 0], [60, 150, 1, 1]) this.b = PointList.generate.radius(count, 140, new Point(500, 300)) // this.b = PointList.generate.random(count, [400,400, 10, 0], [300, 100, 1, 1]) this.c = PointList.generate.random(count) this.currentTime = 0 this.seconds = 4 let commonVal = this.commonVal = new Value() commonVal.doneStop = true commonVal.setEasing(quarticEaseInOut) } draw(ctx) { this.clear(ctx) this.a.pen.fill(ctx, 'green') this.b.pen.fill(ctx, '#333') let spl = 1 / (60 * this.seconds) let lerpKeys = ['x', 'y', 'radius'] let commonVal = this.commonVal let lerps = this.lerps let pa = this.a let pb = this.b let l = this.currentTime += spl this.c.forEach((p,i)=> { let a = pa[i] let b = pb[i] lerpKeys.forEach(k=>{ p[k] = commonVal.pluck(a[k], b[k], l) }) }) this.c.pen.fill(ctx, 'purple') } } ;stage = MainStage.go();
Run
Meta Data
title Raw PointList Lerping
imports ()
files ('head', 'pointlist', 'point', 'stage', 'mouse', '../point_src/random.js', '../point_src/easing.js', '../point_src/iter/lerp.js')
unused_keys ()
unknown_keys ('categories',)
categories ['lerp']
filepath_exists True
path lerp-pointlist-value-only.js
filepath lerp-pointlist-value-only.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/events.js', '../point_src/automouse.js', '../point_src/random.js', '../point_src/easing.js', '../point_src/iter/lerp.js')
markdown {'html': '<p>Lerp points C without affecting points A or B, using a single <code>Value()</code> instance.</p>', 'content': 'title: Raw PointList Lerping\ncategories: lerp\nfiles:\n head\n pointlist\n point\n stage\n mouse\n ../point_src/random.js\n ../point_src/easing.js\n ../point_src/iter/lerp.js\n---\n\nLerp points C without affecting points A or B, using a single `Value()` instance.'}