// Welcome to PDF BBQ!
//
// You can use these shortcuts to get around:
//
// Ctrl+Enter Run your code
// Ctrl+P Print the PDF
//
// These variables are predefined for you:
//
// PDF The PDFLib module
// doc The PDFDocument instance
//
// Hover the [Help] menu above for more
// variables, functions, and shortcuts!
//
// When you're ready, delete this comment
// and start cooking up a PDF! ♨️

let page = doc.addPage(PDF.PageSizes.Letter)
let {width, height} = page.getSize()

let purple = PDF.rgb(0.4, 0.2, 0.6)
let white = PDF.rgb(1, 1, 1)

let head_size = width/4
let eye_size = width/32
let mouth_size = width/7

let cx = width/2
let cy = height/2 + height/8

page.drawCircle({
x: cx,
y: cy,
size: head_size,
color: purple
})

page.drawCircle({
x: cx,
y: cy - mouth_size/8,
size: mouth_size,
color: white
})
page.drawEllipse({
x: cx,
y: cy + mouth_size/8,
xScale: mouth_size*1.25,
yScale: mouth_size/1.25,
color: purple
})

let draw_eye = (offset) => {
page.drawEllipse({
x: cx + eye_size*3*offset,
y: cy + eye_size*2.5,
xScale: eye_size,
yScale: eye_size*1.5,
color: white
})
}
draw_eye(1)
draw_eye(-1)