kopia lustrzana https://github.com/villares/sketch-a-day
				
				
				
			caneta automatica
							rodzic
							
								
									5abf767f34
								
							
						
					
					
						commit
						840e11ee29
					
				|  | @ -0,0 +1,29 @@ | |||
| from __future__ import division | ||||
| 
 | ||||
| def inicie_caneta(): | ||||
|     global caneta | ||||
|     caneta = True | ||||
|     translate(width / 2, height / 2) | ||||
|     rotate(HALF_PI) | ||||
| 
 | ||||
| def suba_caneta(): | ||||
|     global caneta | ||||
|     caneta = False | ||||
| 
 | ||||
| def baixe_caneta(): | ||||
|     global caneta | ||||
|     caneta = True | ||||
| 
 | ||||
| def ande(n): | ||||
|     if caneta: | ||||
|         line(0, -n, 0, 0) | ||||
|     translate(0, -n) | ||||
| 
 | ||||
| def vire(a): | ||||
|     rotate(radians(-a)) | ||||
|      | ||||
| def esquerda(): | ||||
|     vire(90) | ||||
| 
 | ||||
| def direita(): | ||||
|     vire(-90) | ||||
										
											Plik binarny nie jest wyświetlany.
										
									
								
							| Po Szerokość: | Wysokość: | Rozmiar: 3.2 KiB | 
|  | @ -0,0 +1,24 @@ | |||
| from caneta_automatica import * | ||||
| 
 | ||||
| size(400, 400) | ||||
| inicie_caneta() | ||||
| strokeWeight(3) | ||||
| 
 | ||||
| fib = [1, 1] | ||||
| for _ in range(10): | ||||
|     fib.append(fib[-1] + fib[-2]) | ||||
| print(fib) | ||||
| 
 | ||||
| def quadrado(tam): | ||||
|     for _ in range(4): | ||||
|         ande(tam) | ||||
|         esquerda() | ||||
| 
 | ||||
| for t in fib: | ||||
|     quadrado(5 * t) | ||||
|     ande(5 * t) | ||||
|     direita() | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| saveFrame('fib.png') | ||||
		Ładowanie…
	
		Reference in New Issue
	
	 villares
						villares