IAT265 Particle System Example.docx

3 Pages
129 Views
Unlock Document

Department
Interactive Arts & Tech
Course
IAT 265
Professor
Matt Lockyer
Semester
Winter

Description
Particle System Main /* particle system simple particle uses linear motion particle that moves on a wave particles that looks fancy */ BasicParticle p; WaveParticle w; ArrayList particles; void setup() { size(500, 500); p = new BasicParticle(width/2, height/2); w = new WaveParticle(width/2 -50, height/2 -50); particles = new ArrayList(); for(int i = 0; i < 50; i++) { if(i % 2 == 0) { particles.add(new BasicParticle(random(0, width), random(0, height))); } else { particles.add(new WaveParticle(random(0, width), random(0, height))); } } } void draw () { background(255); // polymorphism for(BasicParticle p: particles) { p.update(); p.render(); p.wallBounce(); } } Basic Particle class BasicParticle { /* data position scale veolocity color */ // PVector-x, y (magnitude, direction) PVector pos; float objectScale; PVector vel; color objectColor; float objectSize; // returns instances BasicParticle(float x, float y) { pos = new PVector(x, y);
More Less

Related notes for IAT 265

Log In


OR

Join OneClass

Access over 10 million pages of study
documents for 1.3 million courses.

Sign up

Join to view


OR

By registering, I agree to the Terms and Privacy Policies
Already have an account?
Just a few more details

So we can recommend you notes for your school.

Reset Password

Please enter below the email address you registered with and we will send you a link to reset your password.

Add your courses

Get notes from the top students in your class.


Submit