Created
February 17, 2012 04:15
-
-
Save jonathantorres/1850577 to your computer and use it in GitHub Desktop.
Tick Test on Easel JS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Tick Test</title> | |
<style type="text/css" media="screen"> | |
html, body { margin: 0; padding: 0; overflow: hidden; } | |
#main { margin: 0px; padding: 0px; } | |
</style> | |
<script type="text/javascript" src="js/jquery-1.6.1.min.js"></script> | |
<script type="text/javascript" src="js/easel.js"></script> | |
<script type="text/javascript" src="js/modernizr.js"></script> | |
<script type="text/javascript"> | |
var TickTest = {}; | |
TickTest.Main = new function() { | |
var canvas; | |
var stage; | |
this.init = function() { | |
canvas = document.getElementById('main'); | |
canvas.style.backgroundColor = '#000'; | |
stage = new Stage(canvas); | |
//canvas settings | |
canvas.width = window.innerWidth; | |
canvas.height = window.innerHeight; | |
//settings for stage | |
stage.mouseEventsEnabled = true; | |
Ticker.useRAF = true; | |
Ticker.setFPS(30); | |
Ticker.addListener(window); | |
window.tick = onTick; | |
$(window).resize(onResizeWindow); | |
} | |
function onTick() { | |
console.log('tick'); | |
stage.update(); | |
} | |
/* Re-arrange Objects on Resize */ | |
function reArrange() { | |
canvas.width = window.innerWidth; | |
canvas.height = window.innerHeight; | |
stage.update(); | |
} | |
function onResizeWindow(e) { | |
reArrange(); | |
} | |
} | |
$(document).ready(function() { | |
if (Modernizr.canvas) { | |
TickTest.Main.init(); | |
} | |
}); | |
</script> | |
<meta name="description" content="" /> | |
<meta name="keywords" content="" /> | |
<meta name="robots" content="" /> | |
</head> | |
<body> | |
<canvas id="main"> Canvas not supported :/ </canvas> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment