kopia lustrzana https://github.com/villares/sketch-a-day
				
				
				
			comentários
							rodzic
							
								
									7d58fbc57e
								
							
						
					
					
						commit
						7397efafb1
					
				|  | @ -1,4 +1,9 @@ | |||
| from __future__ import division, unicode_literals | ||||
| """ | ||||
| s33 180204b - Alexandre B A Villares | ||||
| https://abav.lugaralgum.com/sketch-a-day | ||||
| """ | ||||
| 
 | ||||
| from __future__ import division | ||||
| 
 | ||||
| CONFETI = [] | ||||
| SIZE = 15 | ||||
|  | @ -7,28 +12,27 @@ def setup(): | |||
|     size(500, 500) | ||||
|     noStroke() | ||||
|     for _ in range(1200): | ||||
|         CONFETI.append(([random(width),       # [X, | ||||
|                          random(height+20)],  #  Y] -> x, y pos list | ||||
|         CONFETI.append(([random(width),        # [X, | ||||
|                          random(height + 20)], #  Y] -> x, y position list | ||||
|                         random(TWO_PI),  # screen plane rotation | ||||
|                         random(TWO_PI),  # "Z" rotation | ||||
|                         color(random(256), random(256), random(256))  # color | ||||
|                         color(random(256), random(256), random(256)) # color | ||||
|                         )) | ||||
| 
 | ||||
| def draw(): | ||||
|     background(0) | ||||
| 
 | ||||
|     for pos, rot1, rot2, color_ in CONFETI: | ||||
|         with pushMatrix(): | ||||
|             x, y = pos | ||||
|             translate(x, y) | ||||
|     for position, rot1, rot2, color_ in CONFETI: | ||||
|         with pushMatrix():  # contexto do sistema de coordenadas mudado | ||||
|             x, y = position  # umpack da lista position | ||||
|             translate(x, y)  # translada sistema de coordenadas | ||||
|             rotate(rot1 + float(frameCount / 7)) | ||||
|             s = sin(rot2 + float(frameCount / 11)) | ||||
|             fill(color_) | ||||
|             ellipse(0, 0, SIZE, SIZE * s) | ||||
|             pos[1] += 1 + random(0, 2) * s # update y (pos[1]) | ||||
|             position[1] += 1 + random(0, 2) * s  # update y (position[1]) | ||||
|             if y > height + 20: | ||||
|                 pos[1] = -20 | ||||
|     #if frameCount<300 and not frameCount % 3: | ||||
|     #    saveFrame("###.tga") | ||||
|                 position[1] = -20 | ||||
| 
 | ||||
|      | ||||
|     # if frameCount<200 and frameCount % 2 | ||||
|     # saveFrame("###.tga") # salva frames para o GIF | ||||
|  |  | |||
		Ładowanie…
	
		Reference in New Issue
	
	 Alexandre B A Villares
						Alexandre B A Villares