Skip to content

Instantly share code, notes, and snippets.

@dmongeau
Last active December 15, 2015 18:09
Show Gist options
  • Save dmongeau/5301900 to your computer and use it in GitHub Desktop.
Save dmongeau/5301900 to your computer and use it in GitHub Desktop.
require.config({
paths: {
jquery: '../components/jquery/jquery',
underscore: '../components/underscore/underscore',
preloadjs: '../components/scenejs/vendor/preloadjs'
},
shim: {
underscore: {
exports: '_'
},
preloadjs: {
exports: 'createjs'
}
},
packages: [
"scenejs", {
name: "scenejs",
location: "../components/scenejs",
main: "main"
}
]
});
require(['jquery','scenejs','scenes/test'], function ($,scenejs,testScene) {
'use strict';
scenejs.Scene.defaultOptions.onPreload = function(done) {
done();
};
scenejs.Scene.defaultOptions.onPlay = function(done) {
this.preload(function() {
done();
});
};
var resizer = new scenejs.Resizer($('#scene'));
scenejs.Scene.defaultOptions.onResize = function(done) {
resizer.resizeFromHeight($(window).height());
done();
};
resizer.resizeFromHeight($(window).height());
$(window).resize(function() {
testScene.resize();
});
testScene.preload(function() {
console.log('preloaded');
testScene.play(function() {
console.log('playing');
});
});
});
define(['jquery','underscore','scenejs'], function ($,_,scenejs) {
var scene = new scenejs.Scene('scene1', {
'assets' : ['allo.jpg']
});
return scene;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment