Permalink
Browse files

Merge branch 'particles' into gh-pages

  • Loading branch information...
2 parents 43d177c + 5e81849 commit 6476c1c98444da5121b548576feb61ab1670bf2b @tj committed Sep 3, 2011
@@ -2,9 +2,9 @@
<head>
<title>Character Prototype</title>
<link rel="stylesheet" href="public/style.css">
- <link rel="stylesheet" href="../common//preload.css">
+ <link rel="stylesheet" href="../common/preload.css">
<script src="http://code.jquery.com/jquery-1.6.2.js"></script>
- <script src="public/move.js"></script>
+ <script src="../common/move.js"></script>
<!-- <script src="public/tools.js"></script> -->
<script src="public/game.js"></script>
<script src="../common/preload.js"></script>
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -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
Binary file not shown.
View
@@ -0,0 +1,21 @@
+<html>
+ <head>
+ <title>Particles</title>
+ <link rel="stylesheet" href="public/style.css">
+ <link rel="stylesheet" href="../common/preload.css">
+ <script src="http://code.jquery.com/jquery-1.6.2.js"></script>
+ <script src="../common/move.js"></script>
+ <script src="public/game.js"></script>
+ <!--<script src="../common/preload.js"></script>-->
+ </head>
+ <body>
+ <div id="balloons"></div>
+ <div id="guy">
+ <div id="guy-head"></div>
+ <div id="guy-arm-left"></div>
+ <div id="guy-arm-right"></div>
+ <div id="guy-shadow"></div>
+ </div>
+ <div id="grass"></div>
+ </body>
+</html>
Binary file not shown.
@@ -0,0 +1,90 @@
+
+o = $;
+
+/**
+ * Balloons.
+ */
+
+o(function(){
+ move('#balloons')
+ .set('bottom', window.innerHeight)
+ .set('left', 700)
+ .rotate(0)
+ .delay('1s')
+ .duration('5s')
+ .ease('in')
+ .end();
+});
+
+/**
+ * Guy.
+ */
+
+o(function(){
+ var head = o('#guy-head')[0]
+ , balloons = o('#balloons')
+ , max = Math.max
+ , min = Math.min;
+
+ function lookat(x, y) {
+ move('#guy-arm-right')
+ .rotate(max(-(x * .10), -13))
+ .duration(500)
+ .end();
+
+ move('#guy-arm-left')
+ .rotate(min(x * .05, 8))
+ .duration(500)
+ .end();
+
+ move(head)
+ .rotate(max(-(x * .15), -22))
+ .duration('1s')
+ .end();
+ }
+
+ setTimeout(function(){
+ setInterval(function(){
+ var off = balloons.offset();
+ lookat(off.left|0, off.top|0);
+ }, 200);
+ }, 1000);
+})
+
+/**
+ * Rain.
+ */
+
+o(function(){
+ var drops = 30
+ , drop;
+ while (drops--) {
+ drop = o('<div class="rain"></div>');
+ o('body').append(drop);
+ moveDrop(drop);
+ }
+});
+
+function moveDrop(drop) {
+ var x = Math.random() * window.innerWidth * 1.5
+ , y = Math.random() * window.innerHeight * 1.5;
+
+ drop.css({ left: x, top: y });
+
+ function loop() {
+ move(drop)
+ .add('left', 1000)
+ .add('top', 1000)
+ .set('opacity', 0)
+ .duration(Math.random() * 1000 | 0)
+ .then()
+ .set('left', x-1000)
+ .set('top', y-1000)
+ .set('opacity', 1)
+ .duration(0)
+ .pop()
+ .end(loop);
+ }
+
+ loop();
+}
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.
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.
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,75 @@
+body {
+ background: url(../../common/images/bg.jpg);
+ overflow: hidden;
+}
+#balloons {
+ position: absolute;
+ bottom: 90px;
+ left: 90px;
+ width: 223px;
+ height: 433px;
+ background: url(images/balloons.png);
+ z-index: 20;
+ -webkit-transform: rotate(25deg);
+}
+#guy {
+ position: absolute;
+ bottom: 20px;
+ left: 40px;
+ width: 134px;
+ height: 364px;
+ background: url(images/guy-body.png);
+ z-index: 10;
+}
+#guy-shadow {
+ position: absolute;
+ bottom: -20px;
+ left: 30px;
+ width: 78px;
+ height: 80px;
+ background: url(images/guy-shadow.png);
+}
+#guy-head {
+ position: absolute;
+ top: -35px;
+ left: 40px;
+ width: 41px;
+ height: 65px;
+ background: url(images/guy-head.png);
+ -webkit-transform-origin: 50% 75%;
+}
+#guy-arm-left {
+ position: absolute;
+ top: 65px;
+ left: 10px;
+ width: 36px;
+ height: 133px;
+ background: url(images/guy-arm-left.png);
+ -webkit-transform-origin: 20px 0;
+}
+#guy-arm-right {
+ position: absolute;
+ top: 60px;
+ right: 18px;
+ width: 32px;
+ height: 142px;
+ background: url(images/guy-arm-right.png);
+ -webkit-transform-origin: 20px 0;
+ -webkit-transform: rotate(-30deg);
+}
+#grass {
+ position: absolute;
+ bottom: 0;
+ left: 0;
+ width: 310px;
+ height: 231px;
+ background: url(images/grass.png);
+}
+.rain {
+ position: absolute;
+ width: 57px;
+ height: 71px;
+ background: url(images/rain.png);
+ opacity: .5;
+ z-index: 40;
+}

0 comments on commit 6476c1c

Please sign in to comment.