bigwheel
bigwheel is an unopinionated, minimalist framework which handles frontend application state. It can be used to organize your application into "sections"/pages which are brought in by routes. Animation is a first class citizen and is accounted for when managing application states. bigwheel does not conform to a specific render engine framework so a project which is based on the DOM, WebGL, Canvas2D, SVG, or even Console applications can be built using bigwheel.
Full Documentation
https://github.com/bigwheel-framework/documentation
Usage
Example
Note this is not a "best practice" example but simply a concise example that shows many of the features of bigwheel
. Refer to the documentation link above for best practices and other information.
var bigwheel = require('bigwheel');
var Tween = require('gsap');
var framework = bigwheel( function(done) {
return {
routes: {
'/': Section,
'/about': Section,
'/contact': Section
}
};
});
framework.init();
function Section() {
var el;
return {
init: function(req, done) {
el = createEl(req);
el.onclick = function() {
framework.go(getToSection(req));
};
done();
},
resize: function(width, height) {
var fontSize = width / 500 * 30;
el.style.fontSize = fontSize + 'px';
el.style.top = Math.round(( height - fontSize ) * 0.5) + 'px';
},
animateIn: function(req, done) {
Tween.from(el, 1, {
y: -100,
opacity: 0,
ease: Back.easeOut,
onComplete: done
});
},
animateOut: function(req, done) {
Tween.to(el, 0.25, {
y: 100,
opacity: 0,
ease: Back.easeIn,
onComplete: done
});
},
destroy: function(req, done) {
el.parentNode.removeChild(el);
}
};
}
function createEl(req) {
var el = document.createElement('a');
el.innerHTML = 'Click to go from "' + req.route + '" to "' + getToSection(req) + '"';
el.style.position = 'absolute';
el.style.cursor = 'pointer';
return document.body.appendChild(el);
}
function getToSection(req) {
return {
'/': '/about',
'/about': '/contact',
'/contact': '/'
}[ req.route ];
}
License
MIT, see LICENSE.md for details.