kopia lustrzana https://github.com/villares/sketch-a-day
0505
rodzic
9bc2687adc
commit
e15ca0eaa8
|
@ -1,4 +1,8 @@
|
|||
from pytop5js import *
|
||||
# Alexandre B A Villares
|
||||
# run this, install and run pyp5js
|
||||
# instructions at https://pypi.org/project/pyp5js/
|
||||
|
||||
from pyp5js import *
|
||||
|
||||
def setup():
|
||||
createCanvas(400, 400)
|
||||
|
@ -21,6 +25,5 @@ def draw():
|
|||
sy2 = y2 + sin(a2) * r * cos(frameCount/30.)
|
||||
line(sx1, sy1, sx2, sy2)
|
||||
|
||||
|
||||
# This is required by pyp5js to work
|
||||
start_p5(setup, draw)
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
# Sibeli Animation
|
||||
|
||||
w = h = d = 1
|
||||
|
||||
# Cubo
|
||||
max_w = 200
|
||||
max_h = 200
|
||||
max_d = 200
|
||||
|
||||
# plano B - Paralelepípedo
|
||||
# max_w = 100
|
||||
# max_h = 150
|
||||
# max_d = 50
|
||||
|
||||
pausa = 100
|
||||
|
||||
def setup():
|
||||
size(500, 500, P3D)
|
||||
noFill()
|
||||
strokeWeight(5)
|
||||
|
||||
def draw():
|
||||
global w, h, d # para modificar variáveis globais em Python
|
||||
background(200) # fundo e limpa frame
|
||||
translate(250, 250) # muda origem das coordenadas para o centro da tela
|
||||
# giro quando o cubo cresce
|
||||
rotateX((d - 1) / 100.)
|
||||
rotateZ((d - 1) / 100.)
|
||||
# desenha a "caixa" (ponto, linha, retêngulo e caixa...)
|
||||
box(h, w, d)
|
||||
|
||||
if w < max_w:
|
||||
if frameCount > pausa:
|
||||
w += 1
|
||||
elif h < max_h:
|
||||
if frameCount > 2 * pausa + max_w:
|
||||
h += 1
|
||||
elif d < max_d:
|
||||
if frameCount > 3 * pausa + max_w + max_h:
|
||||
d += 1
|
||||
else:
|
||||
noLoop()
|
||||
|
||||
# para salvar frames
|
||||
#saveFrame(str(w) + "_" + str(h) + "_" str(d) + "_frame#####.png")
|
||||
|
||||
|
Ładowanie…
Reference in New Issue