kopia lustrzana https://github.com/villares/sketch-a-day
				
				
				
			Update sketch_2020_04_08a.pyde
							rodzic
							
								
									d30045c4ea
								
							
						
					
					
						commit
						c9b3c3e9eb
					
				|  | @ -1,16 +1,19 @@ | |||
| # inspired by https://twitter.com/beesandbombs/status/1247567578802855938?s=20 | ||||
| # add_library('GifAnimation') | ||||
| # from gif_animation_helper import gif_export | ||||
| add_library('GifAnimation') | ||||
| from gif_animation_helper import gif_export | ||||
| 
 | ||||
| s_size = 100 | ||||
| s_size = 50 | ||||
| COLORS = [color(200, 255, 0), | ||||
|           color(200, 0, 0), | ||||
|           color(0, 0, 255), | ||||
|           color(200, 255, 0), | ||||
|           color(200, 0, 0), | ||||
|           color(0, 0, 255), | ||||
|           ] | ||||
| 
 | ||||
| def setup(): | ||||
|     size(400, 400) | ||||
|     blendMode(ADD) # DIFFERENCE # ECVLUSION | ||||
|     blendMode(ADD)  # DIFFERENCE # ECVLUSION | ||||
|     rectMode(CENTER) | ||||
|     init() | ||||
|      | ||||
|  | @ -19,9 +22,11 @@ def init(): | |||
|     origin = [] | ||||
|     target = [] | ||||
|     for _ in COLORS: | ||||
|         origin.append((width / 2, height / 2)) | ||||
|         origin.append((width / 2., height / 2., 0, s_size)) | ||||
|         target.append((random(s_size, width - s_size), | ||||
|                        random(s_size, height - s_size))) | ||||
|                        random(s_size, height - s_size), | ||||
|                        random(-HALF_PI, HALF_PI), | ||||
|                       random(s_size, s_size * 1.5))) | ||||
| 
 | ||||
| def draw(): | ||||
|     background(0) | ||||
|  | @ -30,14 +35,18 @@ def draw(): | |||
|     t = .5 - cos(radians(frameCount % 360)) / 2. #map(mouseX, 0, width, 0, 1) | ||||
|     for i, cor in enumerate(COLORS): | ||||
|         stroke(cor) | ||||
|         x, y = lerp_sequence(origin[i], target[i], t)     | ||||
|         square(x, y, s_size)  | ||||
|         x, y, r, s = lerp_sequence(origin[i], target[i], t) | ||||
|         pushMatrix() | ||||
|         translate(x, y) | ||||
|         rotate(r) | ||||
|         square(0, 0, s) | ||||
|         popMatrix() | ||||
|          | ||||
|     # if frameCount < 1080: | ||||
|     #     if frameCount % 2: | ||||
|     #        gif_export(GifMaker, "animation") | ||||
|     # else: | ||||
|     #     gif_export(GifMaker, "animation", finish=True) | ||||
|     if frameCount < 1080: | ||||
|         if frameCount % 2: | ||||
|            gif_export(GifMaker, "animation") | ||||
|     else: | ||||
|         gif_export(GifMaker, "animation", finish=True) | ||||
|      | ||||
|     if frameCount % 360 == 0: | ||||
|         init() | ||||
|  |  | |||
		Ładowanie…
	
		Reference in New Issue
	
	 villares
						villares