| 
									
										
										
										
											2018-03-09 02:20:02 +00:00
										 |  |  | """ | 
					
						
							|  |  |  | sketch 67 180308 - Alexandre B A Villares | 
					
						
							|  |  |  | https://abav.lugaralgum.com/sketch-a-day | 
					
						
							|  |  |  | """ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | def setup(): | 
					
						
							|  |  |  |     size(400, 400) | 
					
						
							|  |  |  |     colorMode(HSB) | 
					
						
							|  |  |  |     strokeWeight(5) | 
					
						
							|  |  |  |     noFill() | 
					
						
							|  |  |  |      | 
					
						
							|  |  |  | def draw(): | 
					
						
							|  |  |  |     background(0) | 
					
						
							| 
									
										
										
										
											2018-03-09 02:43:14 +00:00
										 |  |  |     N = map(mouseX, 0, width, PI/6, TWO_PI/3) | 
					
						
							|  |  |  |     D = map(mouseY, 0, height, 1, 3+N) | 
					
						
							| 
									
										
										
										
											2018-03-09 02:20:02 +00:00
										 |  |  |     poly_shape(width/2, height/2, N, D) | 
					
						
							| 
									
										
										
										
											2018-03-09 03:09:08 +00:00
										 |  |  |     #print(N, D) | 
					
						
							|  |  |  |     #if not frameCount % 10: saveFrame("s####.tga") | 
					
						
							| 
									
										
										
										
											2018-03-09 02:20:02 +00:00
										 |  |  |              | 
					
						
							|  |  |  | def poly_shape(x, y, angle, D): | 
					
						
							| 
									
										
										
										
											2018-03-09 02:43:14 +00:00
										 |  |  |         stroke((frameCount/2 * D) % 256, 255, 255, 100) | 
					
						
							| 
									
										
										
										
											2018-03-09 02:20:02 +00:00
										 |  |  |         with pushMatrix(): | 
					
						
							|  |  |  |             translate(x, y) | 
					
						
							| 
									
										
										
										
											2018-03-09 02:43:14 +00:00
										 |  |  |             radius = D * 25  | 
					
						
							| 
									
										
										
										
											2018-03-09 02:20:02 +00:00
										 |  |  |             ps = createShape() | 
					
						
							|  |  |  |             ps.beginShape() | 
					
						
							|  |  |  |             a = 0 | 
					
						
							|  |  |  |             while a < TWO_PI: | 
					
						
							|  |  |  |                 sx = cos(a) * radius | 
					
						
							|  |  |  |                 sy = sin(a) * radius | 
					
						
							|  |  |  |                 ps.vertex(sx, sy) | 
					
						
							|  |  |  |                 a += angle | 
					
						
							|  |  |  |             ps.endShape(CLOSE) | 
					
						
							|  |  |  |             shape(ps, 0, 0); | 
					
						
							|  |  |  |             if D > 1: | 
					
						
							|  |  |  |                for i in range(ps.getVertexCount()): | 
					
						
							|  |  |  |                    pv = ps.getVertex(i) # PVector | 
					
						
							|  |  |  |                    poly_shape(pv.x, pv.y, angle, D-1) |