Skip to content

Instantly share code, notes, and snippets.

@AdrianRossouw
Created June 27, 2014 19:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AdrianRossouw/f4dc73e62f23428dcf0f to your computer and use it in GitHub Desktop.
Save AdrianRossouw/f4dc73e62f23428dcf0f to your computer and use it in GitHub Desktop.
var Engine = require('famous/core/Engine');
var Surface = require('famous/core/Surface');
var FlexibleLayout = require('famous/views/FlexibleLayout');
var mainContext = Engine.createContext();
var colors = [
'rgba(256, 0, 0, .7)',
'rgba(0, 256, 0, .7)',
'rgba(0, 0, 256, .7)'
];
var ratios = [1, 3, 5];
var layout = new FlexibleLayout({
ratios: ratios,
transition: {
curve: 'easeInOut',
duration: 2000
}
});
var surfaces = [];
for (var i = 0; i < 3; i++) {
surfaces.push(new Surface({
size: [undefined, undefined],
properties: {
backgroundColor: colors[i % 3]
}
}));
}
layout.sequenceFrom(surfaces);
mainContext.add(layout);
Engine.on('click', function() {
ratios = ratios.reverse();
layout.setRatios(ratios)
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment