Code Sketch


Happy Easter
By: Anay Narendra Kamat
Category: Art
// Font from: 
// https://befonts.com/happy-easter-display-font.html#google_vignette

cleari

setBackground(cm.linearGradient(0, 0, white, 348, 0, pink, true))


def eggWhiteTexture = cm.radialGradient(
    11, 65, 
    white, 
    50, 
    cm.lightGray, 
    false)

def eggDecoration = cm.radialMultipleGradient(
    0, 87, 
    25, 
    Seq(0,    0.20,0.21), 
    Seq(cm.lightBlue, cm.darkBlue, noColor), 
    true)

def eggShape = Picture.fromVertexShape { x =>
    x.beginShape()
    x.vertex(0, 100-10)
    x.quadraticVertex(-50+10, 100-15, -50+3, 0)
    x.bezierVertex(
        -50, -50-10, 
        50, -50-10, 
        50, 0)
    x.quadraticVertex(50-10, 100-15, 0, 100-10)
    x.endShape()
}.thatsStrokeColored(cm.darkGray)

def egg = picStack(
    Picture{},
    eggShape.thatsFilledWith(eggWhiteTexture),
    eggShape.thatsFilledWith(eggDecoration),
)

def happyEaster = Picture {
    val font = java.awt.Font.createFont(java.awt.Font.TRUETYPE_FONT, new java.io.FileInputStream("/Users/anay/Downloads/HappyEaster.otf")).deriveFont(100F)
    setPenFont(font)
    setPenColor(cm.darkBlue)
    write("Happy\nEaster!!")  
}.thatsStrokeColored(black)

def screenSizedRectangle:Picture = Picture.rect(
    canvasBounds.height, canvasBounds.width
).thatsTranslated(-canvasBounds.width*0.5, -canvasBounds.height*0.5)

screenSizedRectangle.thatsFilledWith(
    cm.radialMultipleGradient(
        canvasBounds.width*0.5, canvasBounds.height*0.5, 
        250, 
        Seq(0,0.4,0.61, 1), 
        Seq(white, white, ColorMaker.hsla(350, 1.00, 0.87, 0.45), noColor),
        false)
).draw




egg.thatsRotated(30).thatsTranslated(-216, 118).draw

egg.thatsRotated(-10).thatsTranslated(216, 0).draw

egg.thatsRotated(-90).thatsTranslated(0, -218).draw

def filter = new com.jhlabs.image.ShadowFilter()
filter.setOpacity(1)

drawCentered(happyEaster.withEffect(filter))