Update sketch_2020_05_24a.pyde

main
villares 2020-05-24 22:33:28 -03:00
rodzic 0f9786ffb3
commit 284555b2db
1 zmienionych plików z 12 dodań i 10 usunięć

Wyświetl plik

@ -1,9 +1,9 @@
# Explorihttps://easings.net/ # Exploring https://easings.net/
# https://gist.github.com/zeffii/c1e14dd6620ad855d81ec2e89a859719 # https://gist.github.com/zeffii/c1e14dd6620ad855d81ec2e89a859719
i = 0 i = 0
def setup(): def setup():
size(500, 400) size(600, 400)
background(0) background(0)
strokeWeight(5) strokeWeight(5)
stroke(255) stroke(255)
@ -11,7 +11,8 @@ def setup():
global easing global easing
easing = ( easing = (
CubicEaseIn, QuadraticEaseIn, CubicEaseIn, QuadraticEaseIn,
SineInOut, QuadraticEaseInOut, CubicEaseInOut, ExponentialInOut, SineInOut, QuadraticEaseInOut,
CubicEaseInOut, ExponentialInOut,
QuadraticEaseOut, CubicEaseOut, QuadraticEaseOut, CubicEaseOut,
) )
f = createFont("DejaVu Sans Mono Bold", 24) f = createFont("DejaVu Sans Mono Bold", 24)
@ -21,10 +22,11 @@ def setup():
def draw(): def draw():
global i global i
w = 480
x = (2 * frameCount) % height + 3 x = (2 * frameCount) % w + 3
t = map(x, 0, height, 0, 1) t = map(x, 0, w, 0, 1)
y = height - height * easing[i](t) y = height - height * easing[i](t)
stroke(i * 32, 255, 255) stroke(i * 32, 255, 255)
point(x, y) point(x, y)
@ -34,7 +36,7 @@ def draw():
fill(i * 32, 255, 255) fill(i * 32, 255, 255)
circle(width - 50, y, 50) circle(width - 50, y, 50)
if x >= height: if x >= w:
fill(0) fill(0)
noStroke() noStroke()
circle(width - 50, 0, 100) circle(width - 50, 0, 100)
@ -71,7 +73,7 @@ def CubicEaseInOut(p):
y = (1/2)((2x)^3) ; [0, 0.5) y = (1/2)((2x)^3) ; [0, 0.5)
y = (1/2)((2x-2)^3 + 2) ; [0.5, 1] y = (1/2)((2x-2)^3 + 2) ; [0.5, 1]
""" """
if (p < 0.5): if p < 0.5:
return 4 * p * p * p return 4 * p * p * p
else: else:
f = ((2 * p) - 2) f = ((2 * p) - 2)
@ -88,10 +90,10 @@ def CubicEaseOut(p):
def draw_name(): def draw_name():
noStroke() noStroke()
fill(0) fill(0)
rect(0, 0, 180, 30) rect(0, 0, 240, 44)
fill(i * 32, 255, 255) fill(i * 32, 255, 255)
textSize(18) textSize(18)
text(easing[i].__name__, 8, 21) text(easing[i].__name__, 28, 40)
def keyPressed(): def keyPressed():
background(0) background(0)