window.onload = function() {
    Crafty.init();
    // A blue block, controlled by arrow keys
    var player = Crafty.e("2D, Canvas, Color, Fourway")
        .attr({x:100, y:100, w:50, h:50})
        .color("blue")
        .fourway(3);
};
A flexible framework
for Javascript games
Show Crafty.js some love:
17 February: version 0.9.0 is out!

Open Source

Crafty is actively developed on Github, and we welcome contributions! See release notes.

Cross Browser compatible

Your games will work on all modern browsers, including IE9.

Canvas or DOM

Choose the technology to render your entities, it will look exactly the same.

Small file size

Small enough that you don't need to wory about it delaying your game.

Entity Component System

A better way to approach game development without long chains of inheritance.

Sprite Map support

Splice and dice a sprite map to easily draw game entities.

Collision Detection

Advanced SAT collision detection with more information than just true or false.

Fire & Forget Events

Event system for custom events that can be triggered whenever, on whatever, and bound just as easily.

Lots 'o Goodies

Heaps of native components for sound, animation, effects and input to make your game pop!

Installation

Direct download

You can download a regular or minified version of Crafty:

crafty.js crafty-min.js

npm module

Crafty is available as an npm module.

$ npm install craftyjs

You can see an example on how to get started:

npm example

Bower installation

With bower installed, the command

$ bower install crafty

will fetch the lastest version of crafty and install it in your project's bower directory.

Bleeding edge

Fresh builds are uploaded by Travis after every successful merge:

Nightly distribution