From b0ae49df849bae56e77ebfb21e5001262a4e3b69 Mon Sep 17 00:00:00 2001 From: Alexandre B A Villares Date: Sun, 14 May 2017 22:57:23 -0300 Subject: [PATCH] Update Esfera.pyde I don't understand what kind of stupid thing I did. I'm very sorry. :(( I just tried again Ctrl-T and it just did what it was supposed to do. --- mode/examples/Demos/Performance/Esfera.pyde | 32 +++++++++++++-------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/mode/examples/Demos/Performance/Esfera.pyde b/mode/examples/Demos/Performance/Esfera.pyde index 13712f34..3192806a 100644 --- a/mode/examples/Demos/Performance/Esfera.pyde +++ b/mode/examples/Demos/Performance/Esfera.pyde @@ -13,46 +13,54 @@ ry = 0 def setup(): - size(1024, 768, P3D) global RADIO, LISTA - RADIO = height/3.5 + size(1024, 768, P3D) + RADIO = height / 3.5 + for _ in range(CUANTOS): LISTA.append(Pelo()) + noiseDetail(3) def draw(): global rx, ry + background(0) - rxp = (mouseX-(width/2)) * 0.005 - ryp = (mouseY-(height/2)) * 0.005 - rx = rx*0.9 + rxp*0.1 - ry = ry*0.9 + ryp*0.1 - translate(width/2, height/2) + + rxp = (mouseX - (width / 2)) * 0.005 + ryp = (mouseY - (height / 2)) * 0.005 + rx = rx * 0.9 + rxp * 0.1 + ry = ry * 0.9 + ryp * 0.1 + + translate(width / 2, height / 2) rotateY(rx) rotateX(ry) fill(0) noStroke() sphere(RADIO) + for pelo in LISTA: pelo.dibujar() class Pelo(): + """A hair""" + def __init__(self): self.z = random(-RADIO, RADIO) self.phi = random(TWO_PI) self.largo = random(1.15, 1.2) - self.theta = asin(self.z/RADIO) + self.theta = asin(self.z / RADIO) def dibujar(self): """Draw""" - off = (noise(millis() * 0.0005, sin(self.phi))-0.5) * 0.3 - offb = (noise(millis() * 0.0007, sin(self.z) * 0.01)-0.5) * 0.3 + off = (noise(millis() * 0.0005, sin(self.phi)) - 0.5) * 0.3 + offb = (noise(millis() * 0.0007, sin(self.z) * 0.01) - 0.5) * 0.3 - thetaff = self.theta+off - phff = self.phi+offb + thetaff = self.theta + off + phff = self.phi + offb x = RADIO * cos(self.theta) * cos(self.phi) y = RADIO * cos(self.theta) * sin(self.phi) z = RADIO * sin(self.theta)