kopia lustrzana https://github.com/villares/sketch-a-day
main
rodzic
7bfd6fc040
commit
ed3deb7d77
21
README.md
21
README.md
|
@ -6,6 +6,27 @@ Hi! I'm [Alexandre Villares](https://abav.lugaralgum.com), let's see if I can ma
|
|||
|
||||
If you enjoy this, be a [patreon](https://patreon.com/arteprog) or make a donation [here](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=HCGAKACDMVNV2)
|
||||
|
||||
|
||||
---
|
||||
|
||||

|
||||
|
||||
229: [code](https://github.com/villares/sketch-a-day/tree/master/s229) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]
|
||||
|
||||
|
||||
---
|
||||
|
||||

|
||||
|
||||
228: [code](https://github.com/villares/sketch-a-day/tree/master/s228) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]
|
||||
|
||||
|
||||
---
|
||||
|
||||

|
||||
|
||||
227: [code](https://github.com/villares/sketch-a-day/tree/master/s227) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]
|
||||
|
||||
---
|
||||
|
||||

|
||||
|
|
Plik binarny nie jest wyświetlany.
Po Szerokość: | Wysokość: | Rozmiar: 58 KiB |
|
@ -0,0 +1,64 @@
|
|||
# Alexandre B A Villares - https://abav.lugaralgum.com/sketch-a-day
|
||||
# s229 20180815
|
||||
add_library('peasycam')
|
||||
|
||||
|
||||
def setup():
|
||||
size(500, 500, P3D)
|
||||
# optional PeasyCam setup to allow orbiting with a mouse drag
|
||||
cam = PeasyCam(this, 100)
|
||||
cam.setMinimumDistance(500)
|
||||
cam.setMaximumDistance(1000)
|
||||
|
||||
def draw():
|
||||
background(100)
|
||||
my_box(200)
|
||||
|
||||
def my_box(side):
|
||||
front = ((-1, +1, -1),
|
||||
(-1, +1, +1),
|
||||
(+1, +1, +1),
|
||||
(+1, +1, -1),
|
||||
)
|
||||
back = ((-1, -1, -1),
|
||||
(-1, -1, +1),
|
||||
(+1, -1, +1),
|
||||
(+1, -1, -1),
|
||||
)
|
||||
left = ((-1, -1, -1),
|
||||
(-1, -1, +1),
|
||||
(-1, +1, +1),
|
||||
(-1, +1, -1),
|
||||
)
|
||||
right = ((+1, -1, -1),
|
||||
(+1, -1, +1),
|
||||
(+1, +1, +1),
|
||||
(+1, +1, -1),
|
||||
)
|
||||
down = ((-1, -1, -1),
|
||||
(+1, -1, -1),
|
||||
(+1, +1, -1),
|
||||
(-1, +1, -1),
|
||||
)
|
||||
top = ((-1, -1, -1),
|
||||
(+1, -1, -1),
|
||||
(+1, +1, -1),
|
||||
(-1, +1, -1),
|
||||
)
|
||||
|
||||
faces = ((top, color(255, 0, 0, 100)),
|
||||
(down, color(0, 255, 0, 100)),
|
||||
(right, color(0, 0, 255, 100)),
|
||||
(left, color(255, 255, 0, 100)),
|
||||
(back, color(255, 0, 255, 100)),
|
||||
(front, color(0, 255, 255, 100)),
|
||||
)
|
||||
|
||||
for pts, shade in faces:
|
||||
hs = side / 2 # half side
|
||||
fill(shade)
|
||||
beginShape()
|
||||
for pt in pts:
|
||||
x, y, z = pt
|
||||
vertex(x * hs, y * hs, z * hs)
|
||||
endShape(CLOSE)
|
Ładowanie…
Reference in New Issue