2021-05-24 22:29:55 +00:00
|
|
|
|
|
|
|
|
2021-05-26 13:16:53 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-19 06:59:15 +00:00
|
|
|
//############################################# -- Intro Animations
|
2021-05-26 13:16:53 +00:00
|
|
|
|
2021-06-19 06:59:15 +00:00
|
|
|
const heroTextSection = document.querySelector(".hero-section > div:nth-child(2)");
|
|
|
|
const myImageBlock = document.querySelector(".benjamin-image-block");
|
|
|
|
const myBigTextBlock = document.querySelector(".benjamin-big-text-block");
|
|
|
|
const mainTextBlock = document.querySelector(".main-text-block");
|
|
|
|
const mainCTA = document.querySelector(".main-cta-button");
|
|
|
|
const allHeaderElements = document.querySelectorAll("header *");
|
|
|
|
const mountains = document.querySelectorAll("#mountains");
|
|
|
|
const clouds = document.querySelectorAll("#clouds");
|
2021-06-19 10:03:18 +00:00
|
|
|
const footerController = document.querySelector(".contact-section-controller");
|
|
|
|
const header = document.querySelector("header");
|
2021-05-26 13:16:53 +00:00
|
|
|
|
|
|
|
|
2021-06-19 06:59:15 +00:00
|
|
|
function intro() {
|
2021-06-19 10:03:18 +00:00
|
|
|
|
2021-06-19 06:59:15 +00:00
|
|
|
anime({
|
|
|
|
targets: heroTextSection,
|
|
|
|
width: [0, "50%"],
|
|
|
|
translateX: [200, 0],
|
|
|
|
easing: "cubicBezier( 0.93, 0, 0.09, 1 )",
|
|
|
|
duration: 1500,
|
|
|
|
delay: 1000,
|
|
|
|
});
|
2021-06-19 10:03:18 +00:00
|
|
|
|
2021-06-19 06:59:15 +00:00
|
|
|
anime({
|
|
|
|
targets: allHeaderElements,
|
|
|
|
translateX: [-20, 0],
|
2021-06-19 10:03:18 +00:00
|
|
|
// rotateY: [50, 0],
|
2021-06-19 06:59:15 +00:00
|
|
|
opacity: [0, 1],
|
|
|
|
easing: "easeOutQuad",
|
|
|
|
duration: 800,
|
2021-06-19 10:03:18 +00:00
|
|
|
delay: anime.stagger(100, { start: 1000 }/* , {easing: 'easeOutQuad'} */),
|
2021-06-19 06:59:15 +00:00
|
|
|
});
|
2021-06-19 10:03:18 +00:00
|
|
|
|
2021-06-19 06:59:15 +00:00
|
|
|
anime({
|
|
|
|
targets: myBigTextBlock,
|
|
|
|
translateY: [100, 0],
|
|
|
|
opacity: [0, 1],
|
|
|
|
easing: "cubicBezier( 0.1, 0.63, 0.355, 1 )",
|
|
|
|
duration: 1200,
|
|
|
|
delay: 2000,
|
|
|
|
});
|
2021-06-19 10:03:18 +00:00
|
|
|
|
2021-06-19 06:59:15 +00:00
|
|
|
anime({
|
|
|
|
targets: myImageBlock,
|
|
|
|
translateY: [100, 0],
|
|
|
|
opacity: [0, 0.8],
|
|
|
|
easing: "cubicBezier( 0.1, 0.63, 0.355, 1 )",
|
|
|
|
duration: 1500,
|
|
|
|
delay: 2200,
|
|
|
|
});
|
2021-06-19 10:03:18 +00:00
|
|
|
|
2021-06-19 06:59:15 +00:00
|
|
|
anime({
|
|
|
|
targets: mainTextBlock,
|
|
|
|
translateX: [-50, 0],
|
|
|
|
opacity: [0, 1],
|
|
|
|
easing: "cubicBezier( 0.1, 0.63, 0.355, 1 )",
|
|
|
|
duration: 1200,
|
|
|
|
delay: 2500,
|
|
|
|
});
|
2021-06-19 10:03:18 +00:00
|
|
|
|
2021-06-19 06:59:15 +00:00
|
|
|
anime({
|
|
|
|
targets: mainCTA,
|
|
|
|
translateX: [-50, 0],
|
|
|
|
opacity: [0, 1],
|
|
|
|
easing: "cubicBezier( 0.1, 0.63, 0.355, 1 )",
|
|
|
|
duration: 1200,
|
|
|
|
delay: 2600,
|
|
|
|
});
|
2021-06-19 10:03:18 +00:00
|
|
|
|
2021-06-19 06:59:15 +00:00
|
|
|
anime({
|
|
|
|
targets: mountains,
|
|
|
|
translateY: [200, 0],
|
|
|
|
opacity: [0, 1],
|
|
|
|
easing: "cubicBezier(0.1, 0.63, 0.355, 1)",
|
|
|
|
duration: 1500,
|
|
|
|
delay: 1000,
|
|
|
|
});
|
2021-06-19 10:03:18 +00:00
|
|
|
|
2021-06-19 06:59:15 +00:00
|
|
|
anime({
|
|
|
|
targets: clouds,
|
|
|
|
opacity: [0.2, 1],
|
|
|
|
easing: "easeOutQuad",
|
|
|
|
duration: 1200,
|
|
|
|
delay: 800,
|
|
|
|
});
|
2021-06-19 10:03:18 +00:00
|
|
|
|
2021-06-19 06:59:15 +00:00
|
|
|
}
|
2021-05-26 13:16:53 +00:00
|
|
|
|
2021-06-19 06:59:15 +00:00
|
|
|
// Intro Initialization
|
2021-05-24 22:29:55 +00:00
|
|
|
|
2021-06-19 06:59:15 +00:00
|
|
|
function introInit() {
|
2021-06-19 10:03:18 +00:00
|
|
|
|
2021-06-19 06:59:15 +00:00
|
|
|
anime({
|
|
|
|
targets: heroTextSection,
|
|
|
|
width: [0],
|
|
|
|
translateX: 200,
|
|
|
|
duration: 0
|
|
|
|
});
|
2021-06-19 10:03:18 +00:00
|
|
|
|
2021-06-19 06:59:15 +00:00
|
|
|
anime({
|
|
|
|
targets: allHeaderElements,
|
|
|
|
translateX: [-20],
|
|
|
|
opacity: [0],
|
|
|
|
duration: 0
|
|
|
|
});
|
2021-06-19 10:03:18 +00:00
|
|
|
|
2021-06-19 06:59:15 +00:00
|
|
|
anime({
|
|
|
|
targets: myBigTextBlock,
|
|
|
|
translateY: [100],
|
|
|
|
opacity: [0],
|
|
|
|
duration: 0
|
|
|
|
});
|
2021-06-19 10:03:18 +00:00
|
|
|
|
2021-06-19 06:59:15 +00:00
|
|
|
anime({
|
|
|
|
targets: myImageBlock,
|
|
|
|
translateY: [100],
|
|
|
|
opacity: [0],
|
|
|
|
duration: 0
|
|
|
|
});
|
2021-06-19 10:03:18 +00:00
|
|
|
|
2021-06-19 06:59:15 +00:00
|
|
|
anime({
|
|
|
|
targets: mainTextBlock,
|
|
|
|
translateX: [-50],
|
|
|
|
opacity: [0],
|
|
|
|
duration: 0
|
|
|
|
});
|
2021-06-19 10:03:18 +00:00
|
|
|
|
2021-06-19 06:59:15 +00:00
|
|
|
anime({
|
|
|
|
targets: mainCTA,
|
|
|
|
translateX: [-50],
|
|
|
|
opacity: [0],
|
|
|
|
duration: 0
|
|
|
|
});
|
2021-06-19 10:03:18 +00:00
|
|
|
|
2021-06-19 06:59:15 +00:00
|
|
|
anime({
|
|
|
|
targets: mountains,
|
|
|
|
opacity: 0,
|
|
|
|
duration: 0
|
|
|
|
});
|
2021-06-19 10:03:18 +00:00
|
|
|
|
2021-05-24 22:29:55 +00:00
|
|
|
}
|
|
|
|
|
2021-06-19 06:59:15 +00:00
|
|
|
introInit();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//############################################# -- Header Scroll interactions
|
2021-05-24 22:29:55 +00:00
|
|
|
|
2021-06-19 06:59:15 +00:00
|
|
|
var headerController = document.querySelector("#header-controller");
|
|
|
|
var windowRect = {
|
|
|
|
rootMargin: "0px",
|
|
|
|
};
|
|
|
|
|
|
|
|
var headerObserver = new IntersectionObserver(changeHeader, windowRect);
|
|
|
|
|
|
|
|
function changeHeader(entry) {
|
2021-06-19 10:03:18 +00:00
|
|
|
|
|
|
|
if (entry[0].isIntersecting) {
|
|
|
|
header.className = "none";
|
2021-06-19 06:59:15 +00:00
|
|
|
anime({
|
|
|
|
targets: "header img",
|
|
|
|
width: 40,
|
|
|
|
height: 100,
|
|
|
|
top: 0,
|
|
|
|
duration: 400,
|
|
|
|
easing: "easeOutCubic",
|
|
|
|
});
|
2021-06-19 10:03:18 +00:00
|
|
|
|
2021-06-19 06:59:15 +00:00
|
|
|
anime({
|
|
|
|
targets: "header > a > div",
|
|
|
|
translateX: 0,
|
|
|
|
opacity: 1,
|
|
|
|
duration: 1000,
|
|
|
|
});
|
2021-06-19 10:03:18 +00:00
|
|
|
|
2021-06-19 06:59:15 +00:00
|
|
|
} else {
|
2021-06-19 10:03:18 +00:00
|
|
|
header.classList.add("scrolled");
|
2021-06-19 06:59:15 +00:00
|
|
|
anime({
|
|
|
|
targets: "header img",
|
|
|
|
width: 60,
|
|
|
|
height: 130,
|
|
|
|
top: 20,
|
|
|
|
duration: 400,
|
|
|
|
easing: "easeOutCubic",
|
|
|
|
});
|
2021-06-19 10:03:18 +00:00
|
|
|
|
2021-06-19 06:59:15 +00:00
|
|
|
anime({
|
|
|
|
targets: "header > a > div",
|
|
|
|
translateX: -50,
|
|
|
|
opacity: 0,
|
|
|
|
duration: 1000,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//############################################# -- Window Load
|
|
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
headerObserver.observe(headerController);
|
|
|
|
}, 3000);
|
2021-05-24 22:29:55 +00:00
|
|
|
|
|
|
|
|
|
|
|
window.addEventListener("load", () => {
|
2021-06-19 10:03:18 +00:00
|
|
|
setTimeout(() => { intro(); }, 1000);
|
2021-06-19 06:59:15 +00:00
|
|
|
|
2021-05-24 22:29:55 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-19 06:59:15 +00:00
|
|
|
//############################################# -- Secitons intersection Observer
|
|
|
|
|
|
|
|
var sections = document.querySelectorAll(".scroll-into-view");
|
|
|
|
//var sectionContainer = document.querySelector(".my-work-section > div:nth-child(2)");
|
|
|
|
|
|
|
|
var windowRect2 = {
|
|
|
|
rootMargin: "0px 0px -200px 0px",
|
|
|
|
};
|
|
|
|
|
|
|
|
var sectionsIO = new IntersectionObserver(sectionsObserverFn, windowRect2);
|
2021-05-25 06:11:47 +00:00
|
|
|
|
2021-06-19 06:59:15 +00:00
|
|
|
function sectionsObserverFn(entries) {
|
2021-06-19 10:03:18 +00:00
|
|
|
|
2021-06-19 06:59:15 +00:00
|
|
|
entries.forEach(entry => {
|
2021-06-19 10:03:18 +00:00
|
|
|
if (entry.isIntersecting) {
|
2021-06-19 06:59:15 +00:00
|
|
|
entry.target.classList.add("scrolled-into-view");
|
2021-06-19 10:03:18 +00:00
|
|
|
headerObserver.observe(footerController);
|
|
|
|
|
|
|
|
// anime({
|
|
|
|
// targets: contents[entry.target.firstElementChild],
|
|
|
|
// width: [0, "50%"],
|
|
|
|
// easing: "cubicBezier( 0.93, 0, 0.09, 1 )",
|
|
|
|
// opacity: [0, 1],
|
|
|
|
// duration: 1200,
|
|
|
|
// });
|
|
|
|
}
|
2021-06-19 06:59:15 +00:00
|
|
|
});
|
2021-06-19 10:03:18 +00:00
|
|
|
|
2021-06-19 06:59:15 +00:00
|
|
|
}
|
2021-05-25 20:49:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-19 06:59:15 +00:00
|
|
|
sections.forEach(item => {
|
|
|
|
sectionsIO.observe(item);
|
2021-05-25 20:49:37 +00:00
|
|
|
});
|
|
|
|
|
2021-05-25 06:11:47 +00:00
|
|
|
|
|
|
|
|
2021-06-19 06:59:15 +00:00
|
|
|
//############################################# -- Content intersection Observer
|
2021-05-24 22:29:55 +00:00
|
|
|
|
2021-06-19 06:59:15 +00:00
|
|
|
const contents = document.querySelectorAll(".scroll-into-view-content");
|
2021-05-24 22:29:55 +00:00
|
|
|
|
2021-06-19 06:59:15 +00:00
|
|
|
const contentsIO = new IntersectionObserver(contentsObserverFn, windowRect2);
|
2021-05-24 22:29:55 +00:00
|
|
|
|
2021-06-19 06:59:15 +00:00
|
|
|
function contentsObserverFn(entries) {
|
2021-06-19 10:03:18 +00:00
|
|
|
|
2021-06-19 06:59:15 +00:00
|
|
|
entries.forEach(entry => {
|
2021-06-19 10:03:18 +00:00
|
|
|
if (entry.isIntersecting) {
|
2021-06-19 06:59:15 +00:00
|
|
|
entry.target.classList.add("scrolled-into-view-content");
|
2021-06-19 10:03:18 +00:00
|
|
|
}
|
2021-06-19 06:59:15 +00:00
|
|
|
});
|
2021-06-19 10:03:18 +00:00
|
|
|
|
2021-06-19 06:59:15 +00:00
|
|
|
}
|
2021-05-24 22:29:55 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-19 06:59:15 +00:00
|
|
|
contents.forEach(item => {
|
|
|
|
contentsIO.observe(item);
|
2021-05-24 22:29:55 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
2021-06-19 06:59:15 +00:00
|
|
|
|
|
|
|
|
|
|
|
const myToolsIcons = document.querySelectorAll(".my-specialties-section > div > div");
|
|
|
|
const myToolsHeader = document.querySelectorAll(".my-specialties-section h2");
|
|
|
|
const myToolsParagraph = document.querySelector(".my-specialties-section p");
|
|
|
|
|
|
|
|
let myToolsIO = new IntersectionObserver(myToolsFn, windowRect2);
|
|
|
|
|
|
|
|
const myToolsIconsAnimated = anime({
|
|
|
|
targets: myToolsIcons,
|
|
|
|
translateX: [-20, 0],
|
|
|
|
translateY: [-20, 0],
|
2021-06-19 10:03:18 +00:00
|
|
|
// rotateY: [50, 0],
|
2021-06-19 06:59:15 +00:00
|
|
|
opacity: [0, 1],
|
|
|
|
easing: "easeOutQuad",
|
|
|
|
duration: 1200,
|
2021-06-19 10:03:18 +00:00
|
|
|
delay: anime.stagger(150, { start: 200 }),
|
2021-06-19 06:59:15 +00:00
|
|
|
loop: false,
|
|
|
|
autoplay: false,
|
2021-06-19 10:03:18 +00:00
|
|
|
complete: function () { myToolsIconsAnimated.remove(myToolsIcons); },
|
2021-05-24 22:29:55 +00:00
|
|
|
});
|
|
|
|
|
2021-06-19 06:59:15 +00:00
|
|
|
function myToolsFn(entries) {
|
2021-06-19 10:03:18 +00:00
|
|
|
|
|
|
|
if (entries[0].isIntersecting) {
|
2021-06-19 06:59:15 +00:00
|
|
|
myToolsIconsAnimated.play();
|
|
|
|
}
|
2021-06-19 10:03:18 +00:00
|
|
|
|
2021-06-19 06:59:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
myToolsIO.observe(myToolsParagraph);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//############################################# -- Contact Form
|
|
|
|
|
2021-06-19 10:03:18 +00:00
|
|
|
|
|
|
|
|
2021-06-19 06:59:15 +00:00
|
|
|
//var form = document.getElementById("my-form");
|
|
|
|
//
|
|
|
|
// async function handleSubmit(event) {
|
|
|
|
// event.preventDefault();
|
|
|
|
// var status = document.getElementById("my-form-status");
|
|
|
|
// var data = new FormData(event.target);
|
|
|
|
// fetch(event.target.action, {
|
|
|
|
// method: form.method,
|
|
|
|
// body: data,
|
|
|
|
// headers: {
|
|
|
|
// 'Accept': 'application/json'
|
|
|
|
// }
|
|
|
|
// }).then(response => {
|
|
|
|
// status.innerHTML = "Thanks for your submission!";
|
|
|
|
// form.reset()
|
|
|
|
// }).catch(error => {
|
|
|
|
// status.innerHTML = "Oops! There was a problem submitting your form"
|
|
|
|
// });
|
|
|
|
// }
|
|
|
|
// form.addEventListener("submit", handleSubmit)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-05-24 22:29:55 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|