Created
June 23, 2021 18:06
-
-
Save iamrobert/2ac18cb3a371849b7fa37db32e46c2f3 to your computer and use it in GitHub Desktop.
Barba Until Animation is done!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pageTransition: Barba.BaseTransition.extend({ | |
start: function () { | |
Promise.all([this.newContainerLoading, this.animIn()]) | |
.then(this.animOut.bind(this)) | |
.then(function () { | |
app.onPageTransitionCompleted(); | |
}); | |
}, | |
animIn: function () { | |
// var loadAnimation = app.transitionAnimation; | |
// return new Promise(function(aniStart) { | |
// loadAnimation.setDirection(1); | |
// loadAnimation.setSpeed(0.8); | |
// loadAnimation.play(); | |
// loadAnimation.onComplete = function() { | |
// aniStart(true); | |
// window.scrollTo(0, 0); | |
// }; | |
// }); | |
return new Promise(function(resolve) { | |
var outer = document.querySelector("#outsideBarba"); | |
outer.classList.add("transitioning"); | |
var animatedEnd = document.querySelector('.animation-loading div:last-child'); | |
// window.setTimeout(function() { | |
// window.scrollTo(0, 0); | |
// resolve(); | |
// }, 300); | |
animatedEnd.onanimationend = function() { | |
// console.log('Animation ended'); | |
window.scrollTo(0, 0); | |
resolve(); | |
}; | |
}); | |
}, | |
animOut: function () { | |
var _this = this; | |
// var loadAnimation = app.transitionAnimation; | |
app.kickstart.set(); | |
return new Promise(function (resolve, reject) { | |
// loadAnimation.setDirection(-1); | |
// loadAnimation.setSpeed(10000); | |
// loadAnimation.play(); | |
// window.scrollTo(0, 0); | |
// _this.done(); | |
// loadAnimation.onComplete = function() { | |
// resolve(); | |
// }; | |
var outer = document.querySelector("#outsideBarba"); | |
outer.classList.remove("transitioning"); | |
outer.classList.add("transitioningOut"); | |
var animatedEnd = document.querySelector('.animation-loading div:last-child'); | |
app.kickstart.set(); | |
_this.done(); | |
animatedEnd.onanimationend = function() { | |
resolve(); | |
outer.classList.remove("transitioningOut"); | |
}; | |
// resolve(); | |
}); | |
} | |
}), |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment