Permalink
Browse files

first commit

  • Loading branch information...
0 parents commit e19fb6cd128d1f453253955dffc04b2e18ab561d user committed Jan 10, 2012
Showing with 1,728 additions and 0 deletions.
  1. 0 README
  2. BIN appengine.png
  3. BIN cloud1.png
  4. BIN cloud2.png
  5. +37 −0 engine.pde
  6. +18 −0 engine.pde~
  7. +278 −0 fly.html
  8. +478 −0 fly.html~
  9. +16 −0 fly0.html
  10. +16 −0 hello.pde
  11. BIN images/bg-back.png
  12. BIN images/header.png
  13. +16 −0 index.html
  14. +12 −0 index.html~
  15. +37 −0 init_processing.js
  16. +16 −0 peoplez.html
  17. +13 −0 processing-1.3.6.min.js
  18. +326 −0 style.css
  19. +326 −0 style.css~
  20. +16 −0 tickle.html~
  21. +82 −0 tickle.pde~
  22. +16 −0 wiggle.html
  23. +25 −0 wiggle.pde
0 README
No changes.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1,37 @@
+// comments go here
+
+float gx = 0;
+float gy = 0;
+PImage fly = new PImage;
+
+void setup()
+{
+ size(500, 500);
+ background(#00ff00);
+ fill(255);
+ frameRate(25);
+
+ fly = loadImage("appengine.png");
+
+}
+
+void draw(){
+ //background(0, 0, 0, 0);
+
+ image(fly, gx, gy);
+}
+
+void keyPressed() {
+ if (keyCode == RIGHT) {
+ gx += 2;
+ }
+ else if (keyCode == LEFT) {
+ gx -= 2;
+ }
+ else if (keyCode == UP) {
+ gy -= 2;
+ }
+ else if (keyCode == DOWN) {
+ gy += 2;
+ }
+}
@@ -0,0 +1,18 @@
+// comments go here
+
+void setup()
+{
+ size(500, 500);
+ background(#00ff00);
+ fill(255);
+ frameRate(25);
+
+ PFont fontA = loadFont("courier");
+ textFont(fontA, 14);
+}
+
+void draw(){
+ // transparent
+ //background(0, 0, 0, 0);
+ text("Hello Peoplez of Europe",20,20);
+}
278 fly.html
@@ -0,0 +1,278 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+ <title>Fly high! </title>
+ <link rel="stylesheet" href="style.css" type="text/css" />
+
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.0/jquery.min.js" type="text/javascript"></script>
+ <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/jquery-ui.min.js" type="text/javascript"></script>
+
+
+</head>
+<body>
+ <script src="processing-1.3.6.min.js"></script>
+
+ <script src="init_processing.js" type="text/javascript"></script>
+ <div id="header">
+ <canvas width="100%" height="100%" id="particle">
+ </canvas>
+ <div class="logo">
+ </div>
+ </div>
+
+
+ <script type="application/processing">
+ /* @pjs transparent=true; */
+
+PFont droidSans;
+ParticleSystem ps_clouds;
+
+int frame;
+
+PImage fly = new PImage;
+PImage[] clouds = new PImage[5];
+
+float gx = 0;
+float gy = 0;
+
+// Setup the Processing Canvas
+void setup(){
+ size($('canvas').width(), $('canvas').height());
+
+ fly = loadImage("appengine.png");
+ //fly = loadImage("super.jpg");
+
+ clouds[0]= loadImage("cloud1.png");
+ clouds[1]= loadImage("cloud2.png");
+ clouds[2]= loadImage("cloud1.png");
+ clouds[3]= loadImage("cloud2.png");
+ clouds[4]= loadImage("cloud1.png");
+
+ frameRate(25);
+ droidSans = createFont("Droid Sans",32);
+ textFont(droidSans);
+
+ ps_clouds = new ParticleSystem(clouds, true);
+
+ smooth();
+}
+
+// Main draw loop
+void draw(){
+
+ if($("#particle").is(":visible")) {
+ size($('canvas').width(), 250);
+
+ // Transparent canvas
+ background(0, 0, 0, 0);
+
+ ps_clouds.run();
+
+ if (ps_clouds.particles.isEmpty()) {
+ ps_clouds = new ParticleSystem(clouds, true);
+ }
+
+ image(fly, gx, gy);
+
+ frame++;
+ }
+
+}
+
+// A simple Particle class
+class Particle {
+ Vector3D loc;
+ Vector3D vel;
+ Vector3D acc;
+ PImage img;
+ var left = false;
+
+ float r;
+ float timer;
+
+ // Constructor
+ Particle(Vector3D l, PImage p_image, var is_left, var is_cloud) {
+ acc = new Vector3D(0.05,0,0);
+ if (is_cloud){
+ the_vel = random(0, 2);
+ }
+ else {
+ the_vel = random(1, 3);
+ }
+
+ vel = new Vector3D(the_vel, 0, 1);
+ loc = l.copy();
+
+ r = 10.0;
+ timer = 1550.0;
+ img = p_image;
+ left = is_left;
+ }
+
+ void run() {
+ update();
+ render();
+ }
+
+ // Method to update location
+ void update() {
+ if (left){
+ loc.sub(vel);
+ }
+ else {
+ loc.add(vel);
+ }
+
+ timer -= 1.0;
+ }
+
+ // Method to display
+ void render() {
+ image(img, loc.x,loc.y);
+ }
+
+ // Is the particle still useful?
+ boolean dead() {
+ if (timer <= 0.0) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+}
+
+
+class ParticleSystem {
+
+ ArrayList particles; // An arraylist for all the particles
+ Vector3D origin; // An origin point for where particles are birthed
+
+ ParticleSystem(PImage[] p_images, var is_clouds) {
+ particles = new ArrayList();
+ var lefty;
+
+ if (lefty) {
+ origin = new Vector3D(0, 0, 0);
+ }
+ else {
+ origin = new Vector3D(width, 0, 0);
+ }
+
+ for (int i = 0; i < p_images.length; i++) {
+ var dice = random(-20, 20);
+ var topped;
+
+ if (is_clouds) {
+ topped = random(-10, 40);
+ }
+ else {
+ topped = random(-10, 150);
+ }
+
+ if (dice > 0) {
+ origin = new Vector3D(width+random(0,50), topped, 1);
+ lefty = true;
+ }
+ else {
+ origin = new Vector3D(random(-200,0), topped, 1);
+ lefty = false;
+ }
+
+ particles.add(new Particle(origin, p_images[i], lefty, is_clouds));
+ }
+ }
+
+ void run() {
+ // Cycle through the ArrayList backwards b/c we are deleting
+ for (int i = particles.size()-1; i >= 0; i--) {
+ Particle p = (Particle) particles.get(i);
+ p.run();
+ if (p.dead()) {
+ particles.remove(i);
+ }
+ }
+ }
+
+ void addParticle(PImage a_image, Vector3D vel) {
+ particles.add(new Particle(origin, vel, a_image));
+ }
+
+ // A method to test if the particle system still has particles
+ boolean dead() {
+ if (particles.isEmpty()) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+}
+
+public class Vector3D {
+ public float x;
+ public float y;
+ public float z;
+
+ Vector3D(float x_, float y_, float z_) {
+ x = x_; y = y_; z = z_;
+ }
+
+ Vector3D(float x_, float y_) {
+ x = x_; y = y_; z = 0f;
+ }
+
+ Vector3D() {
+ x = 0f; y = 0f; z = 0f;
+ }
+
+ public Vector3D copy() {
+ return new Vector3D(x,y,z);
+ }
+
+ public Vector3D copy(Vector3D v) {
+ return new Vector3D(v.x, v.y,v.z);
+ }
+
+ public void add(Vector3D v) {
+ x += v.x;
+ y += v.y;
+ z += v.z;
+ }
+
+ public void sub(Vector3D v) {
+ x -= v.x;
+ y -= v.y;
+ z -= v.z;
+ }
+
+ public Vector3D add(Vector3D v1, Vector3D v2) {
+ Vector3D v = new Vector3D(v1.x + v2.x,v1.y + v2.y, v1.z + v2.z);
+ return v;
+ }
+}
+
+void keyPressed() {
+ if (keyCode == RIGHT) {
+ gx += 2;
+ }
+ else if (keyCode == LEFT) {
+ gx -= 2;
+ }
+ else if (keyCode == UP) {
+ gy -= 2;
+ }
+ else if (keyCode == DOWN) {
+ gy += 2;
+ }
+
+}
+
+</script>
+
+ <div id="main">
+ </div>
+
+
+</body>
+</html>
Oops, something went wrong.

0 comments on commit e19fb6c

Please sign in to comment.