Intro to Crafty - Initializing Crafty
First code demo slide from a crafty js presentation: https://github.com/ajacksified/Craftyjs-Presentation
HTML
<script src="http://craftyjs.com/release/0.5.4/crafty.js"></script>
<div data-role="page" id="p1">
<div data-role="header"><h1>Header Page 1</h1></div>
<div data-role="content">
<div id="cr-stage">
</div>
</div>
<div data-role="footer"><h4>Footer</h4></div>
</div>
JavaScript
Game = {
start: function() {
Crafty.init(480, 800);
Crafty.background('green');
}
}
/*
var width = 400,
height = 300;
Crafty.init(width, height);
var box = Crafty.e("2D, DOM, Color")
.attr({ x: 15, y: 30, w: 20, h: 20 })
.color("#FF9900");
*/