Back
How to's

How to draw a cute cat (and make it move)

Drawing in Umfeld feels just like Processing. Here is a minimal sketch that draws a circle and animates it across the window.

#include "Umfeld.h"

using namespace umfeld;

float x = 0;

void settings() {
    size(640, 480);
}

void setup() {
    background(0.2f);
}

void draw() {
    background(0.2f);
    fill(0.76f, 0.96f, 0.24f);   // umfeld lime
    noStroke();
    circle(x, height / 2, 80);
    x += 2;
    if (x > width) x = 0;
}

Swap the circle() for a few ellipse(), triangle() and line() calls and you have a cat. Add x += sin(frameCount * 0.1f) for a wobble.