Sketches made using joy.py¶

Find out more about joy.py here.

Importing the joy library.¶

In [ ]:
from joy import *

Recursive donut patterns.¶

Trippy visual.

In [ ]:
#Recursive donut patterns.

#random fill color
one_color = color(r=random(10,225),g=random(10,225),b=random(10,225))
two_color = color(r=random(10,225),g=random(10,225),b=random(10,225))
#black base color
base = rectangle(w=300,h=300,fill="black")
c1 = circle(r=10,x=-135,y=0, stroke=one_color, stroke_width=3)
c2 = circle(r=5,x=-135,y=0,fill=two_color, stroke="none")
donut = combine([c1,c2]) 
output = donut | repeat(20,scale(0.85)|rotate(5)) | repeat(36,rotate(10))
show(base, output)

Random lines generator.¶

Inspired by Jackson Pollock's art.

In [ ]:
#Abstract generative art - Random lines generator.
# Inspired by Jackson Pollock's art.

#No of lines.
n=250
#Background
abstract_lines = rectangle(w=300, h=300, fill="black")

# Random color generator.
def random_color():
    r = random(255)
    g = random(255)
    b = random(255)
    a = random(0.1,1)
    return color(r=r, g=g, b=b, a=a)

# Random Line Generator Function.
def line_gen():
    x1,y1=random(-150,150),random(-150,150)
    x2,y2=random(-150,150),random(-150,150)
    str_width=random(1,7)
    return line(x1,y1,x2,y2,stroke=random_color(),stroke_width=str_width)

for i in range(n):
    abstract_lines=abstract_lines+line_gen()

show(abstract_lines)    

Color Bubble Burst.¶

Generates colorful bubbles in random positions.

In [ ]:
# shape = []
def random_color():
    r = random(255)
    g = random(255)
    b = random(255)
    return color(r=r, g=g, b=b, a=0.5)

def random_circle():
    x = random(-150,150)
    y = random(-150,150)
    r = random(1,50)
    c = circle(x=x, y=y, r=r,fill=random_color(), stroke="none")
    return c

output = rectangle(w=300, h=300, fill="black", stroke="none")

for i in range(100):
    output = output + random_circle()

show(output)

RGB everywhere¶

A weird contrast between the RGB boxes and the heavenly white background.

In [ ]:
#RGB everywhere

#no of iterations
n=25

#function to generate random locations.
def random_loc(shape):
    temp = shape |scale(random(0.1,1)) |translate(random(-150,150), random(-150,150))
    return temp

base_color = rectangle(w=300,h=300, fill="white", stroke="none")
green_rectangle = rectangle(w=100,h=100,fill=color(r=0,g=255, b=0, a=0.5), stroke="none")
red_rectangle = rectangle(x=-10,y=-10,w=100,h=100,fill=color(r=255,g=0, b=0, a=0.5), stroke="none")
blue_rectangle = rectangle(x=10,y=10,w=100,h=100,fill=color(r=0,g=0, b=255, a=0.5), stroke="none")
output = red_rectangle + green_rectangle + blue_rectangle

for i in range(n):
    base_color = base_color + random_loc(output)

show(base_color)

VOCAL-1¶

Trying to sketch alphabet letters from scratch using basic shapes in joy.py

In [ ]:
#VOCAL Iteration-1

#Co-ordinate points for triangle.
p1 = point(0,0)
p2 = point(-30,45)
p3 = point(30,45)

#base color
base_color = rectangle(w=300,h=300, fill="#FFFFFF", stroke="none")

#Letter V.
triangle_one = polygon([p1,p2,p3], fill="#000000", stroke="none")
triangle_two = polygon([p1,p2,p3], fill="#FFFFFF", stroke="none") |translate(0,30)
letter_v = combine([triangle_one, triangle_two]) |translate(0,100)

#Letter O
letter_o = circle(r=25, fill="#000000", stroke="none") |translate(0,65)

#Letter C
circle_one = circle(r=30, fill="#000000", stroke="none")
rectangle_mask = rectangle(x=30,y=0,w=60,h=60, fill="#FFFFFF", stroke="none")
circle_mask = circle(r=10, fill="#FFFFFF", stroke="none")
letter_c = combine([circle_one, rectangle_mask, circle_mask]) |translate(10,0)

#Letter A
letter_a = letter_v|scale(y=-1) |translate(0,60)

#Letter L
rectangle_one = rectangle(w=15,h=45, fill="#000000", stroke="none")
rectangle_two = rectangle_one|rotate(90) |translate(16,-15)
letter_l = combine([rectangle_one, rectangle_two]) | translate(-10,-120)
# show(base_color, letter_v, letter_o, letter_c, letter_a, letter_l)
word_vocal = combine([letter_v, letter_o, letter_c, letter_a,letter_l]) |translate(-100)
show(base_color, word_vocal)

VOCAL-2¶

In [ ]:
#VOCAL Iteration-2

#Co-ordinate points for triangle.
p1 = point(0,0)
p2 = point(-30,45)
p3 = point(30,45)

#base color
base_color = rectangle(w=300,h=300, fill="#FFFFFF", stroke="none")

#Letter V.
letter_v = polygon([p1,p2,p3], fill="#000000", stroke="none") |translate(0,100)

#Letter O
circle_one = circle(r=25, fill="#000000", stroke="none") 
circle_two = circle(r=8, fill="#FFFFFF", stroke="none")
letter_o = combine([circle_one, circle_two]) |translate(0,65)

#Letter C
circle_three = circle(r=30, fill="#000000", stroke="none")
rectangle_mask = rectangle(x=30,y=0,w=60,h=60, fill="#FFFFFF", stroke="none")
circle_mask = circle(r=10, fill="#FFFFFF", stroke="none")
letter_c = combine([circle_three, rectangle_mask, circle_mask]) |translate(10,0)

#Letter A
letter_a = letter_v|scale(y=-1) |translate(0,60)

#Letter L
rectangle_one = rectangle(w=15,h=45, fill="#000000", stroke="none")
rectangle_two = rectangle_one|rotate(90) |translate(16,-15)
letter_l = combine([rectangle_one, rectangle_two]) | translate(-10,-120)
# show(base_color, letter_v, letter_o, letter_c, letter_a, letter_l)
word_vocal = combine([letter_v, letter_o, letter_c, letter_a,letter_l]) |translate(-100)
show(base_color, word_vocal)

Fallen down ice cream - minimalism(B&W)¶

In [ ]:
#Fallen down ice cream - minimalism(B&W)

#Co-ordinate points for triangle.
p1 = point(0,65)
p2 = point(-20,0)
p3 = point(20,0)

#base color
base_color = rectangle(w=300,h=300, fill="#FFFFFF", stroke="none")

#ice cream cone
triangle_one = polygon([p1,p2,p3], fill="#FFFFFF", stroke="none")|translate(0,-26)
black_upper = rectangle(0,100,w=600,h=250, fill="#000000", stroke="none")
ice_cream_cone = combine([black_upper, triangle_one]) |rotate(-14)

#fallen ice cream scoop.
ellipse_one = ellipse(w=50, h=30, fill="#000000", stroke="none")
ellipse_two = ellipse(w=75, h=15, fill="#000000", stroke="none") |translate(0, -12) 
ellipse_three = ellipse(w=15, h=5, fill=color(r=0,g=0,b=0,a=0.7), stroke="none") |translate(-30,-30)
ice_cream_scoop = combine([ellipse_one, ellipse_two, ellipse_three]) |translate(-11,-33)

fallen_ice_cream_cone = base_color + ice_cream_scoop + ice_cream_cone
show(fallen_ice_cream_cone)