# teaching machines

## Kawaii Donut

May 4, 2020 by . Filed under public, twoville.

During this time of staying at home, my family has not been able to get out and satisfy our sweet teeth as much as we would like. We have also been faithfully participating in graphic novelist Jarrett Krosoczka’s Draw Everyday with JJK on YouTube.

JJK frequently profiles the work of his illustrator friends, and in episode 33, Joyce Wan taught us how to draw a cute donut. The drawing inspired our hunger but also our creativity. I decided to try and recreate my donut in Twoville. Here is the result:



with viewport
center = :zero2
size = [10, 10]

// Cake annulus.
hole = cutout()

with circle()
center = :zero2
parent = hole

with circle()
center = :zero2
color = [0.6, 0.4, 0]

// Frosting.
seed("trombone")

// We generate a big ungon and a small ungon,
// and subtract the smaller away.
frostingHole = cutout()

with ungon()
color = [1, 0.3, 0.9]
rounding = 1
for i to 360 by 10
angle = i
parent = frostingHole

with ungon()
color = [1, 0.3, 0.9]
rounding = 1
for i to 360 by 10
angle = i

// Sprinkles
seed(897234)

// We generate a random polar coordinate on which
// to center a rounded and randomly rotated and
// colored rectangle. We leave a wedge blank for
// the face.
repeat 60
point = [random(2.6, 4.7), random(0, 290.0) - 55].toCartesian()
with rectangle()
color = :cornflower
center = point
size = [0.5, 0.15]
rounding = 0.1
color = [random(0.6, 1), random(0.6, 1), random(0.6, 1)]
with rotate()
pivot = point
degrees = random(0, 360.0)

// Mouth
with path()
top = -3.6
pull = 1
width = 0.7
jump().position = [-width, top]
closed = true
color = :black
with cubic()
control1 = [-width, top - pull]
control2 = [width, top - pull]
position = [width, top]

// Eyes
to eye(sign)
bottom = -3.2
pull = 0.5
width = 0.7
inner = 0.95
outer = inner + width
with path()
opacity = 0
stroke.size = 0.1
stroke.color = :black
jump().position = [inner * sign, bottom]
with cubic()
control1 = [inner * sign, bottom - pull]
control2 = [outer * sign, bottom - pull]
position = [outer * sign, bottom]

eye(1)
eye(-1)

var twovilleDiv = jQuery('#twoville_donut');
twovilleDiv.closest('pre').replaceWith(twovilleDiv);
document.getElementById('twoville_form_donut').submit();

with viewport
center = :zero2
size = [10, 10]

// Cake annulus.
hole = cutout()

with circle()
center = :zero2
parent = hole

with circle()
center = :zero2
color = [0.6, 0.4, 0]

// Frosting.
seed("trombone")

// We generate a big ungon and a small ungon,
// and subtract the smaller away.
frostingHole = cutout()

with ungon()
color = [1, 0.3, 0.9]
rounding = 1
for i to 360 by 10
angle = i
parent = frostingHole

with ungon()
color = [1, 0.3, 0.9]
rounding = 1
for i to 360 by 10
angle = i

// Sprinkles
seed(897234)

// We generate a random polar coordinate on which
// to center a rounded and randomly rotated and
// colored rectangle. We leave a wedge blank for
// the face.
repeat 60
point = [random(2.6, 4.7), random(0, 290.0) - 55].toCartesian()
with rectangle()
color = :cornflower
center = point
size = [0.5, 0.15]
rounding = 0.1
color = [random(0.6, 1), random(0.6, 1), random(0.6, 1)]
with rotate()
pivot = point
degrees = random(0, 360.0)

// Mouth
with path()
top = -3.6
pull = 1
width = 0.7
jump().position = [-width, top]
closed = true
color = :black
with cubic()
control1 = [-width, top - pull]
control2 = [width, top - pull]
position = [width, top]

// Eyes
to eye(sign)
bottom = -3.2
pull = 0.5
width = 0.7
inner = 0.95
outer = inner + width
with path()
opacity = 0
stroke.size = 0.1
stroke.color = :black
jump().position = [inner * sign, bottom]
with cubic()
control1 = [inner * sign, bottom - pull]
control2 = [outer * sign, bottom - pull]
position = [outer * sign, bottom]

eye(1)
eye(-1)



It’s happy because I can’t eat it.