Skip to content

Using easeljs and tweenjs with requirejs

rogchap edited this page Nov 5, 2012 · 7 revisions

This page explains shortly how to use requirejs along with easeljs and, more importantly, together with tweenjs.

To use easeljs, configure require this way:

require.config({
    shim: {
        easel: {
            exports: 'createjs'
        }
    },
    paths: {
        easel: '../your/path/to/easel'
    }   
});

The paths part is just a shortcut for convenience, so that you can easily reference easel.

To use easeljs and tweenjs, you need to make sure that easeljs is loaded before tweenjs. Otherwise, tweenjs will not work properly - and it won’t even tell you! This can be achieved by declaring easel as dependency for easel:

require.config({
    shim: {
        easel: {
            exports: 'easel'
        }
        tween: {
            deps: ['easel'],
            exports: 'Tween'
        }
    },
    paths: {
        easel: '../your/path/to/easeljs',
        tween: '../your/path/to/tweenjs'
    }   
});

For more detailed information on requirejs configuration options, see http://requirejs.org/docs/api.html#config

Clone this wiki locally