mirror of
				https://github.com/KevinMidboe/cubewaves.git
				synced 2025-10-29 17:40:17 +00:00 
			
		
		
		
	Flow from middle and changed map of height to shrink and grow to.
This commit is contained in:
		| @@ -1,16 +1,17 @@ | ||||
| let angle = 0; | ||||
| let w = 24; | ||||
| let ma; | ||||
| let maxD; | ||||
|  | ||||
| function setup() { | ||||
|    createCanvas(400, 400, WEBGL); | ||||
|    ma = atan(1 / sqrt(2)) | ||||
|    maxD = dist(0, 0, 200, 200); | ||||
| } | ||||
|  | ||||
| function draw() { | ||||
|    background(100); | ||||
|    ortho(-300, 300, 300, -300, 0, 600); | ||||
|  | ||||
|    ortho(-400, 400, 400, -400, 0, 600); | ||||
|  | ||||
|    rotateX(-QUARTER_PI); | ||||
|    rotateY(ma); | ||||
| @@ -19,8 +20,10 @@ function draw() { | ||||
|    for (let z = 0; z < height; z += w) { | ||||
|       for (let x = 0; x < width; x += w) { | ||||
|          push(); | ||||
|          let d = dist(x, z, width / 2,height / 2); | ||||
|          let offset = map(d, 0, maxD, -PI, PI); | ||||
|          let a = angle + offset; | ||||
|          let h = map(sin(a), -1, 1, 0, 100); | ||||
|          let h = floor(map(sin(a), -1, 1, 120, 320)); | ||||
|          translate(x - width / 2, 0, z - height / 2); | ||||
|          normalMaterial(); | ||||
|          box(w - 2, h, w - 2); | ||||
| @@ -30,5 +33,5 @@ function draw() { | ||||
|       offset += 0.1; | ||||
|    } | ||||
|  | ||||
|    angle += 0.1; | ||||
|    angle -= 0.08; | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user