Permalink
Browse files

position rain

  • Loading branch information...
1 parent d7eb5de commit 1956a0d06128e4b5ab0157a0040ec704459dc713 @tj committed Sep 3, 2011
Showing with 26 additions and 2 deletions.
  1. +1 −0 common/move.js
  2. +19 −2 particles/public/game.js
  3. +6 −0 particles/public/style.css
View
@@ -93,6 +93,7 @@
*/
move.select = function(selector){
+ if (selector instanceof jQuery) return selector[0];
if ('string' != typeof selector) return selector;
return document.getElementById(selector)
|| document.querySelectorAll(selector)[0];
View
@@ -11,7 +11,7 @@ o(function(){
, max = Math.max;
function lookat(x, y) {
- move('#guy-head')
+ move(head)
.rotate(max(-(x * .15), -22))
.duration(500)
.end();
@@ -21,4 +21,21 @@ o(function(){
var off = balloons.offset();
lookat(off.left|0, off.top|0);
}, 200);
-})
+})
+
+/**
+ * Rain.
+ */
+
+o(function(){
+ var drops = 30
+ , drop;
+ while (drops--) {
+ drop = o('<div class="rain"></div>');
+ o('body').append(drop);
+ move(drop)
+ .set('left', Math.random() * window.innerWidth)
+ .set('top', Math.random() * window.innerHeight)
+ .end();
+ }
+});
@@ -71,4 +71,10 @@ body {
width: 310px;
height: 231px;
background: url(images/grass.png);
+}
+.rain {
+ position: absolute;
+ width: 57px;
+ height: 71px;
+ background: url(images/rain.png);
}

0 comments on commit 1956a0d

Please sign in to comment.