Displaying articles with tag

Processing: It's totally not Flash

Posted by hank, Fri Jul 20 04:41:00 UTC 2007

I’m not one to advocate Java generally, but Processing is totally hawt. Here’s something I screwed around with today:

Ball[] myBalls;

void setup()
{
  size(500,500);
  frameRate(25);

  myBalls = new Ball[300];
  for (int i = 0; i < 300; i++) {
    myBalls[i] = new Ball();
    myBalls[i].x = random(0, 500);
    myBalls[i].y = random(0, 500);
    myBalls[i].r = random(0, 10);
    myBalls[i].xv = random(-5, 5);
    myBalls[i].yv = random(-5, 5);
    myBalls[i].mycolor = int(random(0, 100));
    myBalls[i].myseed = int(random(25,100));
  }
}

void draw() {
  background(0);
  for (int i = 0; i < 300; i++) {
    myBalls[i].run();
  }
}

class Ball
{
  float x; //X acis centroid
  float y; //Y axis centroid\
  float r; // Radius
  float xv; //X axis velocity
  float yv; //Y axis velocity
  int mycolor;
  int myseed;
  int counter;

  void run()
  {
    drawShape();

    x += xv;
    y += yv;

    yv += 0.4;

    if(x < 0 || x > width) {
      xv = -xv;
    }
    else if(y < 0 || y > height) {
      yv = -1.1 * yv;
    }

    if(counter % myseed == 0) {
      xv = random(-5,5);
      yv = random(-5,5);
    }
    counter++;
  }

  void drawShape()
  {
    smooth();
    ellipseMode(CENTER_RADIUS);
    noStroke();
    fill(mycolor);
    ellipse(x,y,r,r);
  }
}


You can download it here: sketch_070719a

Tags:

0install: A package manager for the lusers

Posted by hank, Thu Jul 19 15:55:00 UTC 2007

Zeroinstall is my new friend. It’s a package manager that’s decentralized, and can be used on machines where users need applications, but don’t know how to compile (or are unwilling to). Installing applications happens in the home directory, and once a program is run once, it is stored in the home directory for later use. All packages can be signed with GPG keys, and the packaging GUI is amazingly awesome.

Check out my 0install repository. You can run things like this:


sudo apt-get install zeroinstall-injector
0launch http://modzer0.cs.uaf.edu/repos/hank/0install/Processing.xml

There’s packages for all the popular distributions. Get it now! It’s awesome.

Tags: