Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 66 lines (52 sloc) 1.475 kB
08d92d3 @presstube part 1 complete
authored
1 <html>
2 <head>
3 <title>Cyclic Vacuum Cannon</title>
4 <style type="text/css">
5 body {
6 padding: 0px;
7 margin: 0px;
8 background-color: #333;
9 }
10 </style>
11 </head>
12 <body onload="new p.CyclicVacuumCannonApp">
13 <canvas id="canvas"></canvas>
14 <script type="text/javascript" src="http://code.createjs.com/easeljs-0.5.0.min.js"></script>
15 <script type="text/javascript">
16
17 // herein lies the juice
18
19 // namespacing & shortcuts
20 var c = createjs;
21 var presstube = {};
22 var p = presstube;
23
24 // create our app
25 p.CyclicVacuumCannonApp = function() {
26
27 var canvas = document.getElementById("canvas");
28 var stage = new c.Stage(canvas);
29 var bgRect = new c.Shape;
30 var centeredContainer = new c.Container;
31 var placeholderDot = new c.Shape;
32
33 c.Ticker.setFPS(30);
34 c.Ticker.addListener(stage);
35
36 stage.onTick = function(e) {
37 // console.log("stage tick here!", e);
38 }
39
40 function resize() {
41 canvas.width = window.innerWidth;
42 canvas.height = window.innerHeight;
43
44 bgRect.graphics.clear().beginFill("333").drawRect(0, 0, canvas.width, canvas.height);
45
46 centeredContainer.x = canvas.width / 2;
47 centeredContainer.y = canvas.height / 2;
48 }
49 resize();
50 window.onresize = resize;
51
52 stage.onClick = function(e) {
53 // console.log("stage click here!", e);
54 }
55
56 stage.addChild(bgRect);
57 placeholderDot.graphics.beginFill("f00").drawCircle(0, 0, 30);
58 centeredContainer.addChild(placeholderDot);
59 stage.addChild(centeredContainer);
60
61 }
62
63
64 </script>
65 </body>
66 </html>
Something went wrong with that request. Please try again.