Thursday, January 8, 2009

Homework 1, An Intro to Processing


This software is actually surprisingly easy to catch on to. Considering I spent 40 min to an hour on it, the sword I threw together with the basic functions is neat enough. Below is the code used to create this image. And yes, I agree, that red background is way too bright, but I am ok with that.

void setup()
{
size (400,400);
stroke (225);
background (255, 0, 0);
}

void draw()
{
//blade
line (169, 50, 169, 280);
line (184, 50, 184, 280);
line (177, 10, 177, 273); //center line
line (169, 50, 177, 10);
line (184, 50, 177, 10);
//hilt left
line (169, 280, 140, 275);
line (169, 280, 177, 273);
line (140, 275, 137, 282);
line (137, 282, 168, 290);
//hilt right
line (184, 280, 213, 275);
line (184, 280, 177, 273);
line (213, 275, 216, 282);
line (216, 282, 185, 290);
//grip
line (168, 290, 185, 290);
line (168, 290, 170, 340);
line (185, 290, 183, 340);
//pommel
ellipse (176.5, 345, 20, 20);
//jewel
ellipse (176.5, 283, 5, 5);

saveFrame ("sword.png");
}

No comments:

Post a Comment