Testing loading and fixed animation start
This commit is contained in:
parent
c641f9a0a5
commit
74f6ab0609
3 changed files with 25 additions and 9 deletions
|
@ -76,6 +76,14 @@ p {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#loading-bg {
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
position: fixed;
|
||||||
|
background-color: #E79A58;
|
||||||
|
z-index: 99;
|
||||||
|
}
|
||||||
|
|
||||||
@media screen and (min-width: 700px) {
|
@media screen and (min-width: 700px) {
|
||||||
.block {
|
.block {
|
||||||
background-color: var(--color-main-light);
|
background-color: var(--color-main-light);
|
||||||
|
|
13
js/base.js
13
js/base.js
|
@ -5,6 +5,8 @@
|
||||||
var urlStr = window.location.toString().slice(0, window.location.toString().lastIndexOf(window.location.pathname) + 1);
|
var urlStr = window.location.toString().slice(0, window.location.toString().lastIndexOf(window.location.pathname) + 1);
|
||||||
//Getting the dir name by gathering the pathname and substract it with the last '/'.
|
//Getting the dir name by gathering the pathname and substract it with the last '/'.
|
||||||
var dirStr = window.location.pathname.substring(1, window.location.pathname.lastIndexOf('/'));
|
var dirStr = window.location.pathname.substring(1, window.location.pathname.lastIndexOf('/'));
|
||||||
|
//the head tag
|
||||||
|
var headTag = document.getElementsByTagName("head")[0];
|
||||||
//Global variable set to true when finished loading external html/css/js files
|
//Global variable set to true when finished loading external html/css/js files
|
||||||
var finishedLoading = false;
|
var finishedLoading = false;
|
||||||
|
|
||||||
|
@ -117,10 +119,14 @@ function popUpPlacement(className) {
|
||||||
/****************************************/
|
/****************************************/
|
||||||
/* main */
|
/* main */
|
||||||
/****************************************/
|
/****************************************/
|
||||||
|
window.addEventListener('load', function () {
|
||||||
|
var body = document.getElementsByTagName("body")[0];
|
||||||
|
//loading elements
|
||||||
|
var loadingBackground = document.createElement("div");
|
||||||
|
loadingBackground.id = "loading-bg";
|
||||||
|
body.insertBefore(loadingBackground, body.firstChild);
|
||||||
|
});
|
||||||
//Loading the html,js and css of navbar and footer
|
//Loading the html,js and css of navbar and footer
|
||||||
//During the loading process we need a loading status bar
|
|
||||||
var headTag = document.getElementsByTagName("head")[0];
|
|
||||||
window.addEventListener('load', function () {
|
window.addEventListener('load', function () {
|
||||||
//instant loading
|
//instant loading
|
||||||
loadJS("//code.iconify.design/1/1.0.6/iconify.min.js", headTag);
|
loadJS("//code.iconify.design/1/1.0.6/iconify.min.js", headTag);
|
||||||
|
@ -132,6 +138,7 @@ window.addEventListener('load', function () {
|
||||||
load(urlStr + "components/footer.html", document.getElementsByTagName("Footer")[0], urlStr + "js/footer.js", headTag).then(() => {
|
load(urlStr + "components/footer.html", document.getElementsByTagName("Footer")[0], urlStr + "js/footer.js", headTag).then(() => {
|
||||||
finishedLoading = true;
|
finishedLoading = true;
|
||||||
popUpPlacement("black-bg");
|
popUpPlacement("black-bg");
|
||||||
|
document.getElementById("loading-bg").style.display = "none";
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
})
|
})
|
11
js/index.js
11
js/index.js
|
@ -27,7 +27,7 @@ var saoulAnimation = anime({
|
||||||
],
|
],
|
||||||
rotate: [
|
rotate: [
|
||||||
{ value: 0, duration: 100, delay: 0 },
|
{ value: 0, duration: 100, delay: 0 },
|
||||||
{ value: -60, duration: 1000, delay: 100 }
|
{ value: -780, duration: 1000, delay: 100 }
|
||||||
],
|
],
|
||||||
begin: function () {
|
begin: function () {
|
||||||
document.getElementsByClassName("photosaoul")[0].style.display = "flex";
|
document.getElementsByClassName("photosaoul")[0].style.display = "flex";
|
||||||
|
@ -37,13 +37,15 @@ var saoulAnimation = anime({
|
||||||
var whiteBandAnimation = anime({
|
var whiteBandAnimation = anime({
|
||||||
targets: '.whiteband',
|
targets: '.whiteband',
|
||||||
easing: 'easeInExpo',
|
easing: 'easeInExpo',
|
||||||
|
autoplay: false,
|
||||||
width: "100%",
|
width: "100%",
|
||||||
duration: 2200,
|
duration: 1200,
|
||||||
})
|
})
|
||||||
|
|
||||||
var textAnimation = anime({
|
var textAnimation = anime({
|
||||||
targets: '.anim-text',
|
targets: '.anim-text',
|
||||||
easing: 'easeInOutExpo',
|
easing: 'easeInOutExpo',
|
||||||
|
autoplay: false,
|
||||||
opacity: [
|
opacity: [
|
||||||
{ value: 0, duration: 2000, delay: 0 },
|
{ value: 0, duration: 2000, delay: 0 },
|
||||||
{ value: 100, duration: 1000, delay: 100 }
|
{ value: 100, duration: 1000, delay: 100 }
|
||||||
|
@ -92,14 +94,13 @@ window.addEventListener("scroll", function (e) {
|
||||||
/* functions */
|
/* functions */
|
||||||
/****************************************/
|
/****************************************/
|
||||||
|
|
||||||
|
|
||||||
async function playIndexAnimation() {
|
async function playIndexAnimation() {
|
||||||
while (!finishedLoading) {
|
while (!finishedLoading) {
|
||||||
await new Promise(resolve => setTimeout(resolve, 200));
|
await new Promise(resolve => setTimeout(resolve, 200));
|
||||||
}
|
}
|
||||||
setTimeout(() => {
|
|
||||||
whiteBandAnimation.play();
|
whiteBandAnimation.play();
|
||||||
textAnimation.play();
|
textAnimation.play();
|
||||||
|
setTimeout(() => {
|
||||||
saoulAnimation.restart();
|
saoulAnimation.restart();
|
||||||
}, 500);
|
}, 1200);
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue