example and code for: bouncing growing line
code for: bouncing bowie
example and code: simple drawing tool
code for: drawing bowie
Try to break up your project into specific user stories - you should have at least 2 (but more might be necessary). The idea is to think about your software design in terms of specific requirements and to create a user story about each one. These can simply be typed into a text document and included in your processing project folder.
here's the basic format:
1. statement in the form "As a [user role], I want to [goal], so I can [reason]."
2. brief discussion/explanation of the requirement (including a diagram/sketch if necessary)
3. confirmation - how will you know if the feature is working
for example
1. As a [user], I want to [press/release the mouse], so I can [start/stop drawing]
2. Discussion - the tool should only draw when the mouse button is pressed down, when the user releases the button, drawing should stop
3. Confirmation
1. success: user presses the mouse and drawing starts, user releases the mouse and drawing stops
2. failure: drawing continues if user is not pressing the mouse button
// set an image variable
PImage arrow;
// set a speed variable
float speed;
void setup() {
// set your display size(400,400);
// load the image
arrow = loadImage("arrow.png");
}
void draw() {
// draw with points
//point(mouseX, mouseY);
// calculate speed
speed = abs(mouseX-pmouseX);
// control the stroke weight strokeWeight(speed);
// draw with lines
//line(mouseX, mouseY,pmouseX,pmouseY);
// draw with an image
image(arrow,mouseX,mouseY,speed,speed);
}