(Java)Example Processing Sketch

Create Canvas dengan ukuran 700 500

 	public void setup() {
		size(700,500);
		// Initialize all "stripes"
		for (int i = 0; i < stripes.length; i++) {
			stripes[i] = new Stripe(this);
		}
	}

Create backgroud berjalan dengan warna yang kita inginkan dengan 500000 (Hijau)

public void draw() {
		background(500000);
		// Move and display all "stripes"
		for (int i = 0; i < stripes.length; i++) {
			stripes[i].move();
			stripes[i].display();
		}
	} 

Full Code

 import processing.core.*;

public class MyProcessingSketch extends PApplet {
//	An array of stripes
	Stripe[] stripes = new Stripe[50];

	public void setup() {
		size(700,500);
		// Initialize all "stripes"
		for (int i = 0; i < stripes.length; i++) {
			stripes[i] = new Stripe(this);
		}
	}

	public void draw() {
		background(500000);
		// Move and display all "stripes"
		for (int i = 0; i < stripes.length; i++) {
			stripes[i].move();
			stripes[i].display();
		}
	}
}

Run
5-12-2014 5-49-51 AM

Advertisements

Published by

jarcode

hello I am jarcode

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s