/* home-animation.js ================= This file is manually included by the home_inc-js.php file within this themes directory if animations are not disabled. This file is only loaded on the homepage of this theme, and doesn't apply animations across the site. If you wish to apply an animation across the whole site then please do so in global-animation.js Remember that animations are theme specific, meaning this file only effects the current theme that you are animating, and not every theme across the TemplateOTS platform. See detailed documentation here:- https://docs.google.com/document/d/1n5sWQ8SIr-zjOpTv8YnOTHJapO8WdedjDfbeo-lkqMM/edit#heading=h.lmxb59mpcpe2 */ (function () { // Set the inital animation delay for the home page var nHomePageAnimationDelay = 0; /* On Document Loaded ================== Called by Jquery event handler when the document is ready (When content has been loaded) */ $( document ).ready( function() { // Try and store the home page imaeg block var oHomePageImage4Block = $(".home-4-image-imageblock-background .container #home-top-4-image-image-block"); // Try and store the home page imaeg block var oHomePageImage3Block = $(".home-3-image-imageblock-background .container #home-top-3-image-image-block"); // Try and store the full overlay var oFullOverlay = $("#full-overlay"); // If the full overlay element exists if( oFullOverlay.length ) { // Set the inital animation delay nHomePageAnimationDelay = 2; // Set the offset top var nOffsetTop = 0; // Store the logo var oLogo = $("#logo"); // Store the full overlay background var oFullOverlayBackground = $("#full-overlay-background"); // If the logo exists if( oLogo.length ) { // Store the offset top nOffsetTop = oLogo.offset().top; } // If the full screen overlay exists if(oFullOverlayBackground.length) { // Animate the overlay TweenMax.to( oFullOverlayBackground, 0.5, { opacity : 0, delay : 1.5, ease : Power2.easeIn, onComplete : function() { // Delete the element on complete oFullOverlayBackground.remove(); } }); } // Animate the overlay logo TweenMax.to( oFullOverlay, 1, { opacity : 0, top : ( -($(window).height() / 2 - ($(window).height() / 20) ) ) + nOffsetTop, delay : 1, ease : Power2.easeIn, onComplete : function() { // Delete the element on complete oFullOverlay.remove(); } }); } // If the animation element exists if( oHomePageImage4Block.length ) { // Animate the homepage element fAnimateHomePageImage4Block(oHomePageImage4Block); } // If the animation element exists if( oHomePageImage3Block.length ) { // Animate the homepage element fAnimateHomePageImage3Block(oHomePageImage3Block); } }); /* fAnimateHomePageImage4Block() ============================ Called when the page loads, simply animates the home page image block */ function fAnimateHomePageImage4Block(oHomePageImage4Block) { // Set the inital animation speed var nAnimationSpeed = 0.25; // Loop through all children of the home page image block oHomePageImage4Block.children().each( function() { // Animate the card TweenMax.to( $(this), nAnimationSpeed, { opacity : 1, rotateY : "0", ease : Power2.easeIn, delay : nHomePageAnimationDelay }); // Increase the animation speed nAnimationSpeed += 0.3; }); } /* fAnimateHomePageImage3Block() ============================ Called when the page loads, simply animates the home page image block */ function fAnimateHomePageImage3Block(oHomePageImage3Block) { // Set the inital animation speed var nAnimationSpeed = 0.25; // Loop through all children of the home page image block oHomePageImage3Block.children().each( function() { // Animate the card TweenMax.to( $(this), nAnimationSpeed, { opacity : 1, rotateY : "0", ease : Power2.easeIn, delay : nHomePageAnimationDelay }); // Increase the animation speed nAnimationSpeed += 0.3; }); } }());