pseudo3DRotate-projection-types.js

total 0
used 0
limit 0
/* --- title: pseudo3D Orthogonal vs Perspective categories: pseudo3D 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/pointlistpen.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/random.js ../point_src/setunset.js ../point_src/stroke.js ../point_src/stage-clock.js ../point_src/text/alpha.js ../point_src/rotate.js ../point_src/text/fps.js ../point_src/functions/clamp.js ../point_src/distances.js ../point_src/dragging.js Rotate a plane in 3D */ class MainStage extends Stage { // canvas = document.getElementById('playspace'); canvas = 'playspace' mounted(){ this.center.radius = 50 this.rotSize = 0 this.projection = 300 this.perspective = true let radius = 7 let rowCount = 5 /* How many items per row within the grid */ let count = 50 let cy = this.center.y let center = {x:500, y:cy} const pointList = PointList.generate.grid(20, 5, 30, {x:400, y:cy-200}) const pointList2 = PointList.generate.grid(20, 5, 30, {x:400, y:cy+100}) this.centerPoint = new Point(center) // pointList.forEach(p=>p.radius = 2 + random.int(15)) this.points = pointList this.points2 = pointList2 this.dragging.add(this.centerPoint) this.events.wake() } step() { this.rotSize += 1 let spin = {x:0, y: this.rotSize, z: 0} // orthogonal let spunPoints let center = this.centerPoint; if(this.perspective) { spunPoints = pseudo3DRotate(this.points, spin, center, false) spunPoints = pseudo3DRotatePerspective(spunPoints, center, this.projection) } this.spunPointsA = spunPoints.map(p=>new Point(p)) this.spunPointsB = pseudo3DRotate(this.points2, spin, center, true).map(p=>new Point(p)) } draw(ctx){ this.step() this.clear(ctx) this.spunPointsA.pen.indicators(ctx, { color: 'gray', width: 1}) this.spunPointsB.pen.indicators(ctx, { color: '#aaa', width: 1}) this.centerPoint.pen.indicator(ctx, { color: 'red', width: 1}) // this.points.pen.indicators(ctx, { color: 'gray', width: 1}) this.fps.drawFPS(ctx); } } stage = MainStage.go()
Run
Meta Data
title pseudo3D Orthogonal vs Perspective
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/pointlistpen.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/random.js', '../point_src/setunset.js', '../point_src/stroke.js', '../point_src/stage-clock.js', '../point_src/text/alpha.js', '../point_src/rotate.js', '../point_src/text/fps.js', '../point_src/functions/clamp.js', '../point_src/distances.js', '../point_src/dragging.js')
unused_keys ()
unknown_keys ('categories',)
categories ['pseudo3D']
filepath_exists True
path pseudo3DRotate-projection-types.js
filepath pseudo3DRotate-projection-types.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/pointlistpen.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/random.js', '../point_src/setunset.js', '../point_src/stroke.js', '../point_src/stage-clock.js', '../point_src/text/alpha.js', '../point_src/rotate.js', '../point_src/smooth-number.js', '../point_src/text/fps.js', '../point_src/functions/clamp.js', '../point_src/distances.js', '../point_src/protractor.js', '../point_src/text/beta.js', '../point_src/dragging.js')
markdown {'html': '<p>Rotate a plane in 3D</p>', 'content': '---\ntitle: pseudo3D Orthogonal vs Perspective\ncategories: pseudo3D\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/pointlistpen.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/random.js\n ../point_src/setunset.js\n ../point_src/stroke.js\n ../point_src/stage-clock.js\n ../point_src/text/alpha.js\n ../point_src/rotate.js\n ../point_src/text/fps.js\n ../point_src/functions/clamp.js\n ../point_src/distances.js\n ../point_src/dragging.js\n\nRotate a plane in 3D'}