iterator-example.js

total 0
used 0
limit 0
/* categories: iteration mutators files: ../point_src/math.js ../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/stage.js ../point_src/extras.js ../point_src/iter/beta.js --- An iterator can automatically count between a range. */ /* iter/beta */ class MainStage extends Stage { // canvas = document.getElementById('playspace'); canvas = 'playspace' mounted(){ const mutators = new Mutators(this) let x = 200 , y = 200 , amplitude = this.amplitude = 90 , c = this.c = new Point(x,y) , p = this.point = new Point(x, y) ; p.radius = 30 c.radius = amplitude this.xIter = new Iterator(x, [ (v)=> mutators.stageLimit(v, 'width') // , (v)=>mutators.sin(v, amplitude) ]) this.yIter = new Iterator(y, [ (v)=>mutators.stageLimit(v, 'height') // , (v)=>mutators.cos(v, amplitude) ]) this.rotIter = new Iterator(0, [ (v)=>mutators.modulus(v, 360) ]) } draw(ctx){ this.clear(ctx) let c = this.c let p = this.point let speed = .02 let amplitude = this.amplitude p.x = c.x + Math.sin(this.xIter.step(speed)) * amplitude p.y = c.y + Math.cos(this.yIter.step(speed)) * amplitude p.rotation = this.rotIter.step(-2) c.pen.indicator(ctx, {color:'grey'}) p.pen.indicator(ctx, {color:'green'}) } } stage = MainStage.go()
Run
Meta Data
imports ()
files ('../point_src/math.js', '../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/stage.js', '../point_src/extras.js', '../point_src/iter/beta.js')
unused_keys ('title',)
unknown_keys ('categories',)
categories ['iteration', 'mutators']
filepath_exists True
path iterator-example.js
filepath iterator-example.js
clean_files ('../point_src/math.js', '../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/stage-resize.js', '../point_src/functions/resolve.js', '../point_src/stage.js', '../point_src/extras.js', '../point_src/iter/beta.js')
markdown {'html': '<p>An iterator can automatically count between a range.</p>', 'content': 'categories: iteration\n mutators\nfiles:\n ../point_src/math.js\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/stage.js\n ../point_src/extras.js\n ../point_src/iter/beta.js\n---\n\nAn iterator can automatically count between a range.'}