Skip to content

Commit

Permalink
Update Esfera.pyde
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
villares committed May 15, 2017
1 parent 92cf533 commit b0ae49d
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions mode/examples/Demos/Performance/Esfera.pyde
Expand Up @@ -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)
Expand Down

0 comments on commit b0ae49d

Please sign in to comment.