Self-portrait as a young robot

Concept

For my digital self-portrait I tried to represent my inner robot.

Code

The drawing consists of simple shapes that use a mix of manual and calculated coordinates.

The location of the mouth is automatically calculated to be horizontally centered and 3/4 of the way down the canvas. The code uses variables that allow the size of the mouth rectangle to be easily changed and the position will be automatically recalculated.

// Set the mouth width and height
let rectangleWidth = 150;
let rectangleHeight = 90;

{...}

// Draw a centered rectangle
rect((width / 2) - (rectangleWidth / 2), height * 0.75 - rectangleHeight / 2, rectangleWidth, rectangleHeight);

Completed self-portrait:

Reflection / Future Work

The robot expresses my inner coder. In future I would like to add animated laser beams shooting from the eyes that automatically track the mouse cursor.

Leave a Reply