Files
cheesy-arena-lite/static/js/audience.js

80 lines
1.9 KiB
JavaScript
Raw Normal View History

2014-06-09 21:06:25 -07:00
// Copyright 2014 Team 254. All Rights Reserved.
// Author: nick@team254.com (Nick Eyre)
2014-06-09 23:18:58 -07:00
var screens = {
blank: {
init: function(cb){callback(cb);},
open: function(cb){callback(cb);},
close: function(cb){callback(cb);}
},
logo: {
init: function(cb){
$('.blinds.center:not(.blank)').css({rotateY: '-180deg'});
callback(cb);
},
open: function(cb){
closeBlinds(function(){
setTimeout(function(){
$('.blinds.center.blank').transition({rotateY: '180deg'});
$('.blinds.center:not(.blank)').transition({rotateY: '0deg'}, function(){
callback(cb);
});
}, 400);
});
},
close: function(cb){
$('.blinds.center.blank').transition({rotateY: '360deg'});
$('.blinds.center:not(.blank)').transition({rotateY: '180deg'}, function(){
openBlinds(callback);
});
}
}
};
var currentScreen = 'blank';
function openScreen(screen){
2014-06-09 21:06:25 -07:00
2014-06-09 23:18:58 -07:00
// If Screen Exists
if(typeof(screens[screen]) == 'object' && $('.template#'+screen).length > 0 && currentScreen != screen){
// Initialize New Screen
$('#topcontainer').append("<div class='container' id='"+screen+"'>"+$('.template#'+screen).html()+"</div>");
screens[screen].init(function(){
// Close Current Screen
screens[currentScreen].close(function(){
// Open New Screen
currentScreen = screen;
screens[screen].open();
});
2014-06-09 21:06:25 -07:00
});
}
}
2014-06-09 23:18:58 -07:00
function callback(cb){
if(typeof(cb) == 'function')
cb();
}
function closeBlinds(cb){
2014-06-09 21:25:15 -07:00
$('.blinds.right').transition({right: 0});
$('.blinds.left').transition({left: 0}, function(){
2014-06-09 21:06:25 -07:00
$(this).addClass('full');
2014-06-09 23:18:58 -07:00
callback(cb);
2014-06-09 21:06:25 -07:00
});
}
2014-06-09 23:18:58 -07:00
function openBlinds(cb){
2014-06-09 21:25:15 -07:00
$('.blinds.right').show();
$('.blinds.left').removeClass('full');
$('.blinds.right').show().transition({right: '-50%'});
$('.blinds.left').transition({left: '-50%'}, function(){
2014-06-09 23:18:58 -07:00
callback(cb);
2014-06-09 21:06:25 -07:00
});
}