kopia lustrzana https://github.com/villares/sketch-a-day
				
				
				
			01,02,03
							rodzic
							
								
									90ab12883d
								
							
						
					
					
						commit
						1e253f3776
					
				
										
											Plik binarny nie jest wyświetlany.
										
									
								
							| Po Szerokość: | Wysokość: | Rozmiar: 1.4 MiB | 
										
											Plik binarny nie jest wyświetlany.
										
									
								
							| Po Szerokość: | Wysokość: | Rozmiar: 1.7 MiB | 
|  | @ -1,7 +1,5 @@ | ||||||
| """Grid study""" | """Grid study""" | ||||||
| 
 |  | ||||||
| from random import choice | from random import choice | ||||||
| 
 |  | ||||||
| from grid import Grid | from grid import Grid | ||||||
| 
 | 
 | ||||||
| def setup(): | def setup(): | ||||||
|  | @ -15,7 +13,7 @@ def setup(): | ||||||
| 
 | 
 | ||||||
| def create_grids(): | def create_grids(): | ||||||
|     global grids |     global grids | ||||||
|     grids = []     |     grids = [] | ||||||
|     for i in range(10): |     for i in range(10): | ||||||
|         d = int(random(4, 11)) |         d = int(random(4, 11)) | ||||||
|         sp = 20 |         sp = 20 | ||||||
|  | @ -24,18 +22,27 @@ def create_grids(): | ||||||
|         si = random(15, 35) |         si = random(15, 35) | ||||||
|         sh = choice((ELLIPSE, ELLIPSE, RECT, RECT, TRIANGLE, TRIANGLES)) |         sh = choice((ELLIPSE, ELLIPSE, RECT, RECT, TRIANGLE, TRIANGLES)) | ||||||
|         grids.append(Grid(pos=(x, y), |         grids.append(Grid(pos=(x, y), | ||||||
|                            dims=(d, d), |                           dims=(d, d), | ||||||
|                            space=sp, |                           space=sp, | ||||||
|                            elem=(sh, si)) |                           elem=(sh, si)) | ||||||
|                       ) |                      ) | ||||||
|  |         global ix, iy | ||||||
|  |         ix, iy, _ = grids[0].pos | ||||||
|  |         print ix, iy | ||||||
|  | 
 | ||||||
| def draw(): | def draw(): | ||||||
|     background(240) |     background(240) | ||||||
|     translate(width / 2., height / 2.) |     translate(width / 2., height / 2.) | ||||||
|     # scale(.5, .5) |     # scale(.5, .5) | ||||||
|      | 
 | ||||||
|     for g in grids: |     for g in grids: | ||||||
|         g.update() |         g.update() | ||||||
| 
 | 
 | ||||||
|  |     saveFrame("###.png") | ||||||
|  |     fx, fy, _ = grids[0].pos | ||||||
|  |     if (ix, iy) == (fx, fy): | ||||||
|  |         exit() | ||||||
|  | 
 | ||||||
| def keyPressed(): | def keyPressed(): | ||||||
|     if key == "s": |     if key == "s": | ||||||
|         saveFrame("####.png") |         saveFrame("####.png") | ||||||
|  |  | ||||||
										
											Plik binarny nie jest wyświetlany.
										
									
								
							| Po Szerokość: | Wysokość: | Rozmiar: 2.0 MiB | 
|  | @ -26,8 +26,12 @@ def create_grids(): | ||||||
|         grids.append(Grid(pos=(x, y), |         grids.append(Grid(pos=(x, y), | ||||||
|                            dims=(d, d), |                            dims=(d, d), | ||||||
|                            space=sp, |                            space=sp, | ||||||
|                            elem=(sh, si)) |                            elem=(sh, si))) | ||||||
|                       ) |          | ||||||
|  |         global ix, iy | ||||||
|  |         ix, iy, _ = grids[0].pos | ||||||
|  |         print ix, iy | ||||||
|  |          | ||||||
| def draw(): | def draw(): | ||||||
|     background(240) |     background(240) | ||||||
|     translate(width / 2., height / 2.) |     translate(width / 2., height / 2.) | ||||||
|  | @ -36,6 +40,11 @@ def draw(): | ||||||
|     for g in grids: |     for g in grids: | ||||||
|         g.update() |         g.update() | ||||||
| 
 | 
 | ||||||
|  |     saveFrame("###.png") | ||||||
|  |     fx, fy, _ = grids[0].pos | ||||||
|  |     if (ix, iy) == (fx, fy): | ||||||
|  |         exit() | ||||||
|  | 
 | ||||||
| def keyPressed(): | def keyPressed(): | ||||||
|     if key == "s": |     if key == "s": | ||||||
|         saveFrame("####.png") |         saveFrame("####.png") | ||||||
|  |  | ||||||
|  | @ -0,0 +1,40 @@ | ||||||
|  | """ | ||||||
|  | Alexandre B A Villares http://abav.lugaralgum.com - GPL v3  | ||||||
|  | 
 | ||||||
|  | A helper for the Processing gifAnimation library https://github.com/extrapixel/gif-animation/tree/3.0 | ||||||
|  | Download from https://github.com/villares/processing-play/blob/master/export_GIF/unzip_and_move_to_libraries_GifAnimation.zip | ||||||
|  | This helper was inspired by an example by Art Simon https://github.com/APCSPrinciples/AnimatedGIF/ | ||||||
|  | 
 | ||||||
|  | # add at the start of your sketch: | ||||||
|  |   add_library('gifAnimation') | ||||||
|  |   from gif_exporter import gif_export | ||||||
|  | # add at the end of draw(): | ||||||
|  |   gif_export(GifMaker) | ||||||
|  | """ | ||||||
|  | 
 | ||||||
|  | def gif_export(GifMaker,             # gets a reference to the library | ||||||
|  |                filename="exported",  # .gif will be added | ||||||
|  |                repeat=0,             # 0 makes it an "endless" animation | ||||||
|  |                quality=255,          # quality range 0 - 255 | ||||||
|  |                delay=200,            # this is quick | ||||||
|  |                frames=0,             # 0 will stop on keyPressed or frameCount >= 100000 | ||||||
|  |                finish=False):        # force stop | ||||||
|  |     global gifExporter | ||||||
|  |     try: | ||||||
|  |         gifExporter | ||||||
|  |     except NameError: | ||||||
|  |         gifExporter = GifMaker(this, filename + ".gif") | ||||||
|  |         gifExporter.setRepeat(repeat) | ||||||
|  |         gifExporter.setQuality(quality) | ||||||
|  |         gifExporter.setDelay(delay) | ||||||
|  |          | ||||||
|  |     gifExporter.addFrame() | ||||||
|  | 
 | ||||||
|  |     if frames == 0: | ||||||
|  |        if keyPressed and key == "e": | ||||||
|  |            finish = True | ||||||
|  |                  | ||||||
|  |     if finish: | ||||||
|  |         gifExporter.finish() | ||||||
|  |         print("gif saved") | ||||||
|  |         exit() | ||||||
										
											Plik binarny nie jest wyświetlany.
										
									
								
							| Po Szerokość: | Wysokość: | Rozmiar: 2.3 MiB | 
										
											Plik binarny nie jest wyświetlany.
										
									
								
							| Po Szerokość: | Wysokość: | Rozmiar: 1.6 MiB | 
							
								
								
									
										19
									
								
								README.md
								
								
								
								
							
							
						
						
									
										19
									
								
								README.md
								
								
								
								
							|  | @ -20,11 +20,28 @@ You may also support my artistic work, open teaching resources and research with | ||||||
| 
 | 
 | ||||||
| --- | --- | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | 
 | ||||||
|  | [sketch_190803a](https://github.com/villares/sketch-a-day/tree/master/2019/sketch_190803a) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)] | ||||||
|  | 
 | ||||||
|  | --- | ||||||
|  | 
 | ||||||
|  |  | ||||||
|  | 
 | ||||||
|  | [sketch_190802a](https://github.com/villares/sketch-a-day/tree/master/2019/sketch_190802a) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)] | ||||||
|  | 
 | ||||||
|  | --- | ||||||
|  | 
 | ||||||
|  |  | ||||||
|  | 
 | ||||||
|  | [sketch_190801a](https://github.com/villares/sketch-a-day/tree/master/2019/sketch_190801a) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)] | ||||||
|  | 
 | ||||||
|  | --- | ||||||
|  | 
 | ||||||
|  |  | ||||||
| 
 | 
 | ||||||
| [sketch_190731a](https://github.com/villares/sketch-a-day/tree/master/2019/sketch_190731a) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)] | [sketch_190731a](https://github.com/villares/sketch-a-day/tree/master/2019/sketch_190731a) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)] | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| --- | --- | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  |  | ||||||
		Ładowanie…
	
		Reference in New Issue
	
	 villares
						villares