Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

adds balloon example

  • Loading branch information...
commit a1a4f1d3254ebf2929bd754e570ae5d276f573f4 1 parent e807377
Semmy Purewal authored
Showing with 2 additions and 1 deletion.
  1. +1 −0  examples/balloons.json
  2. +1 −1  examples/dir.json
1  examples/balloons.json
@@ -0,0 +1 @@
+{"title":"Balloons Floating into Spikes", "source":"int radius;\nArrayList<Balloon> balloons;\n\nvoid setup()\n{\n size(400,400);\n balloons = new ArrayList<Balloon>();\n balloons.add(new Balloon());\n noStroke();\n frameRate(30);\n}\n\n\nvoid draw(){\n background(150,255,255);\n\n\n for(int i = 0;i < balloons.size(); i++) {\n b = balloons.get(i);\n if(b.y-b.radius < 40) {\n balloons.remove(i);\n i--;\n }\n b.draw(); \n b.update();\n }\n if(frameCount%10==0) {\n balloons.add(new Balloon());\n }\n \n fill(220,220,220);\n int offset = frameCount%width;\n for(int i = 0; i < width; i=i+20) { \n triangle(i, 0, i+10, 40, i+20, 0);\n }\n}\n\nclass Balloon {\n int x;\n int y;\n int radius;\n int offset;\n int shake;\n int r;\n int g;\n int b;\n \n Balloon() {\n radius = random(30)+10;\n x = random(width);\n y = height+radius;\n offset = random(5);\n shake = random(80)+2;\n r = random(155)+100;\n g = random(155)+100;\n b = random(155)+100;\n }\n \n void update() {\n y = y-1;\n x = x+sin((frameCount+offset)/shake)*5;\n }\n \n void draw() {\n fill(r,g,b);\n ellipse(x,y,7*(radius*2)/8,radius*2);\n triangle(x,y+radius, x-(radius/6), y+radius+(radius/6), x+(radius/6), y+radius+(radius/6));\n }\n}"}
2  examples/dir.json
@@ -1 +1 @@
-[{"title":"hello", "url":"hello.json"}, {"title":"have a nice day", "url":"nice_day.json"}]
+[{"title":"hello web", "url":"hello.json"}, {"title":"have a nice day", "url":"nice_day.json"}, {"title":"Balloons Floating into Spikes", "url":"balloons.json"}]
Please sign in to comment.
Something went wrong with that request. Please try again.