Creating a trail of moving object in Processing

From dftwiki3
Revision as of 07:41, 17 June 2012 by Thiebaut (talk | contribs) (Created page with "--~~~~ ---- <bluebox> This tutorial page explores various techniques for marking the path of animated objects in Processing. Many of the ideas and techniques presented here are ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

--D. Thiebaut 08:41, 17 June 2012 (EDT)


This tutorial page explores various techniques for marking the path of animated objects in Processing. Many of the ideas and techniques presented here are taken from the [Processing.org] site, which remains one of the best resource for Processing. Don't hesitate to browse its pages for good ideas!


Unlimited Trail

Here we just start with the basic idea which we already played with in [Processing Skeleton Project and Simple Exercises | the previous tutorial in this section].


package tutorial1;
 
import processing.core.*;
 
public class Main extends PApplet {
 
	public void setup() {
		// define the window size, make graphics softer, and make
		// the background white
		size(600, 600);
		smooth();
		background(255);
	}
 
	public void draw() {
                // erase screen
		background(255);
 
                // change color of circle paint depending on mouse button
		if (mousePressed) 
			fill(0);
		else 
			fill(255);
 
                // draw a circle where the mouse is located
		ellipse(mouseX, mouseY, 80, 80);
	}
}












Tutorials:ProcessingTutorial:Java