-- Heart
function setup()
end
function draw()
background(255)
translate(WIDTH/2,HEIGHT/2)
color(255,0,0)
fill(255,0,0)
stroke(255,0,0)
strokeWidth(5)
font("SnellRoundhand-Black")
textMode(CENTER)
fontSize(100)
text("Be My Valentine", 0, HEIGHT*3/8)
fontSize(75)
text("I Love You!", 0, -HEIGHT*5/16)
text("-- R", 200, -HEIGHT*3/8)
drawHeart( 0, 0,200)
drawHeart(-300, 200, 50)
drawHeart( 300, 200, 50)
drawHeart(-250,-200, 50)
drawHeart( 250,-200, 50)
drawHeart(-400, 0, 50)
drawHeart( 400, 0, 50)
end
function drawHeart(cx,cy,sc)
pushMatrix()
translate(cx,cy)
scv = sc*0.75
for x = -1,1,0.01 do
xx = x*sc
yt = heartTop(x)*scv
yb = heartBot(x)*scv
line(xx,yt,xx,yb)
end
popMatrix()
end
function heartTop(x)
return (x*x)^0.33 + math.sqrt(1 - x*x)
end
function heartBot(x)
return (x*x)^0.33 - math.sqrt(1 - x*x)
end
Nice Valentine.
I learned that heart equation probably 60 years ago
@RonJeffries - all things condence down to maths. Nice demo. Thanks