Friday, 16 January 2015

Design Iterations - Face Tracking Project

Face Tracking Project - 5

Moving on from the previous blog post (see post Face Tracking - 4) I have one more part to complete for my circle tracking project, which is the particle system. I had been pushed towards looking at Daniel Shiffman's particle systems by lecturer and this has pretty much solved the problem. I have found a website created by Daniel Shiffman called the Nature of Code. This in terms of learning about processing is simply a gold mine. Within this website there was a large part of particle systems. 

Using this website I was able to create a particle system that I will implement within my installation. It is a simple system where particles are spawned into the world from a designated position, which in my case will be the middle of the circle, and then these particles go about their "lives". The code has been written so that each particle is affected differently by the physical elements, such as gravity, and each one has its own random life span. This means one particle can remain on the screen for up to 10 seconds and others will die within 2. Below is the particle system that has been made. 

I will edit this particle system to make the physics within in more random, which should make the particles act more individual instead of all mostly doing the same thing. I will also change the design of the particle to make it more visually appealing. 

The code 

Particle p;
ArrayList<Particle> particles;
void setup() {
  particles= new ArrayList<Particle>();
void draw() {
  particles.add(new Particle(new PVector(width/2,50)));
  for (int i = 0; i < particles.size(); i++) {
    Particle p = particles.get(i);;
    if (p.isDead()){
class Particle {
  PVector location;
  PVector velocity;
  PVector acceleration;
  float lifespan;
  Particle(PVector l) {
    acceleration = new PVector(0,0.05);
    velocity = new PVector(random(-1,1),random(-2,0));
    location = l.get();
    lifespan = 255.0;
  void run() {
  void update() {
    lifespan -= 2.0;
  void display() {
  boolean isDead() {
    if (lifespan < 0.0) {
      return true;
    } else {
      return false;

Reference List 

Shiffman, D., 2012. Chapter 4. Particle Systems. The Nature Of Code, Available from: [Accessed 16 January 2015].

No comments:

Post a Comment