kopia lustrzana https://github.com/villares/sketch-a-day
				
				
				
			Update sketch_190910b.pyde
							rodzic
							
								
									f19136c25e
								
							
						
					
					
						commit
						974ab02ce1
					
				|  | @ -1,28 +1,25 @@ | ||||||
| from __future__ import division | from __future__ import division | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | ox, oy = 0, 0 | ||||||
|  | 
 | ||||||
| def setup(): | def setup(): | ||||||
|     size(600, 600) |     size(600, 600) | ||||||
|     blendMode(MULTIPLY) |     blendMode(MULTIPLY) | ||||||
|     rectMode(CENTER) |     rectMode(CENTER) | ||||||
|     noStroke() |  | ||||||
|     noLoop() |     noLoop() | ||||||
|     global ox, oy |      | ||||||
|     ox, oy = 0 , 0 |  | ||||||
| 
 |  | ||||||
|          |  | ||||||
| def draw(): | def draw(): | ||||||
|     colorMode(RGB) |     colorMode(RGB) | ||||||
|     background(240, 240, 220) |     background(240, 240, 220) | ||||||
|     rec_grid(width / 2, height / 2, 2, 580) |     rec_grid(width / 2, height / 2, 2, 580) | ||||||
|      |      | ||||||
| def rec_grid(x, y, n, tw): | def rec_grid(x, y, n, tw): | ||||||
| 
 |     global ox, oy | ||||||
|     pushMatrix() |     pushMatrix() | ||||||
|     translate(x, y) |     translate(x, y) | ||||||
|     cw = tw / n |     cw = tw / n | ||||||
|     margin = (cw - tw) / 2 |     margin = (cw - tw) / 2 | ||||||
| 
 |  | ||||||
|     for i in range(n): |     for i in range(n): | ||||||
|         nx = cw * i + margin |         nx = cw * i + margin | ||||||
|         for j in range(n): |         for j in range(n): | ||||||
|  | @ -31,22 +28,15 @@ def rec_grid(x, y, n, tw): | ||||||
|                 rec_grid(nx, ny, 2, cw) |                 rec_grid(nx, ny, 2, cw) | ||||||
|             elif cw < 8: |             elif cw < 8: | ||||||
|                 colorMode(HSB) |                 colorMode(HSB) | ||||||
|                 c = map(cw, 5, width / 4, 0, 250) |                 fill(dist(ox, oy, nx, ny)/ 5., 255, 255) | ||||||
|                 fill(c, 200, 255) |  | ||||||
|                 noStroke() |                 noStroke() | ||||||
|                 # circle(nx, ny, cw - 2)                 |                 circle(nx, ny, cw - 2)                 | ||||||
|                 global ox, oy |                 stroke(0, 100) | ||||||
|                 stroke(dist(ox, oy, nx, ny)/ 5., 255, 255) |  | ||||||
|                 line(ox, oy, nx, ny) |                 line(ox, oy, nx, ny) | ||||||
|                 ox += x |                 ox += x | ||||||
|                 oy += y   |                 oy += y   | ||||||
| 
 |  | ||||||
|   |  | ||||||
|                                  |  | ||||||
|     popMatrix() |     popMatrix() | ||||||
| 
 | 
 | ||||||
|      |  | ||||||
|      |  | ||||||
| def keyPressed(): | def keyPressed(): | ||||||
|     saveFrame("####.png") |     saveFrame("####.png") | ||||||
|     redraw() |     redraw() | ||||||
|  |  | ||||||
		Ładowanie…
	
		Reference in New Issue
	
	 Alexandre B A Villares
						Alexandre B A Villares