Permalink
Browse files

cleaned up animations (still WIP)

  • Loading branch information...
gtanner committed Oct 4, 2012
1 parent 518da10 commit c65e142e9a6c0ee3716170714f51deff6e8d4f6b
Showing with 1,618 additions and 78 deletions.
  1. +7 −17 server/app.js
  2. +11 −4 server/display.js
  3. +7 −25 server/public/css/main.css
  4. +3 −7 server/public/index.html
  5. +1,558 −0 server/public/js/alice.js
  6. +32 −25 server/public/js/index.js
View
@@ -14,6 +14,7 @@
* limitations under the License.
*/
var express = require('express'),
+ display = require('./display'),
app = express.createServer(),
io = require('socket.io').listen(app),
grid = [];
@@ -30,25 +31,14 @@ io.sockets.on('connection', function (socket) {
socket.emit('count', { clients: io.sockets.clients().length });
socket.broadcast.emit('added', { clients: io.sockets.clients().length });
- socket.on('row', function (args) {
- grid.push([]);
- grid[grid.length - 1].push(socket);
- });
-
- socket.on('col', function (args) {
- grid[grid.length - 1].push(socket);
- });
-
- socket.on('start', function () {
- socket.broadcast.emit('started');
- var display = require("./display"),
- x = 0;
- display.init(grid);
- setInterval(function () {
- display.render(++x % 2 ? "full" : "tile");
- }, 5000);
+ socket.on('disconnect', function () {
+ socket.broadcast.emit('added', { clients: io.sockets.clients().length - 1 });
});
});
+setInterval(function () {
+ display.render('tile', io);
+}, 5000);
+
app.listen(3000);
console.log("listening on 3000");
View
@@ -20,15 +20,22 @@ module.exports = {
grid = g;
},
- render: function (plugin) {
+ render: function (plugin, io) {
var plugin = require("./display/" + plugin),
row, col;
plugin.init();
- for (row = 0; row < grid.length; row++) {
- for (col = 0; col < grid[row].length; col++) {
- grid[row][col].emit('img', plugin.render(row, col));
+ if (io) {
+ io.sockets.clients().forEach(function (s) {
+ s.emit('img', plugin.render());
+ });
+ }
+ else {
+ for (row = 0; row < grid.length; row++) {
+ for (col = 0; col < grid[row].length; col++) {
+ grid[row][col].emit('img', plugin.render(row, col));
+ }
}
}
}
View
@@ -3,33 +3,15 @@
margin-left: 50%
}
-#img {
- width: 1024px;
- height: 600px;
+.img {
+ width: 100%;
+ height: 100%;
+ position: fixed;
+ top: 0;
+ left: 0;
}
body {
margin: 0;
-}
-
-button {
- background: #ececec;
- background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ececec), color-stop(100%,#dadada));
- background: -webkit-linear-gradient(top, #ececec 0%,#dadada 100%);
- background: linear-gradient(top, #ececec 0%,#dadada 100%);
- border: 1px solid #ababab;
- -webkit-border-radius: 3px;
- border-radius: 3px;
- -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .1), 0 1px 1px rgba(255, 255, 255, .8) inset;
- box-shadow: 0 1px 2px rgba(0, 0, 0, .1), 0 1px 1px rgba(255, 255, 255, .8) inset;
- color: #707070;
- font-family: 'Helvetica Neue', Helvetica, Arial, Geneva, sans-serif;
- font-size: 12px;
- font-weight: bold;
- -webkit-font-smoothing: antialiased;
- margin: 5px;
- outline: none;
- padding: 10px 15px;
- float: left;
- text-align: center;
+ background: grey;
}
View
@@ -3,16 +3,12 @@
<script src="/socket.io/socket.io.js"></script>
<script src="/js/zepto.js"></script>
<script src="/js/index.js"></script>
+ <script src="/js/alice.js"></script>
<link rel="stylesheet" href="css/main.css" />
</head>
<body>
- <div id="setup">
- <button id="row">Row</button>
- <button id="col">+1</button>
- </div>
+ <div id="img1" class="img" />
+ <div id="img2" class="img" />
<div id="count">0</div>
- <button id="start">Start</button>
- <div id="img" />
- <div id="imgs" />
</body>
</html>
Oops, something went wrong.

0 comments on commit c65e142

Please sign in to comment.