Scroll animations refined
This commit is contained in:
parent
ed0ab02f0b
commit
5c855e092f
@ -4,16 +4,20 @@
|
||||
|
||||
const translate = document.querySelectorAll(".translate");
|
||||
var watermark = document.querySelector(".hero-watermark");
|
||||
var skewedBg = document.querySelector(".skewed-bg");
|
||||
//var skewedBg = document.querySelector(".skewed-bg");
|
||||
|
||||
|
||||
|
||||
window.addEventListener("scroll", () => {
|
||||
|
||||
var scroll = window.pageYOffset;
|
||||
|
||||
translate.forEach(element => {
|
||||
let speed = element.dataset.speed;
|
||||
element.style.transform = "translateY(" + (scroll * speed) + "px)";
|
||||
});
|
||||
|
||||
// skewedBg.style.transform = "translateY(" + (scroll * skewedBg.dataset.speed) + "px) skewY(-3deg)";
|
||||
watermark.style.transform = "translateY(" + (scroll * watermark.dataset.speed) + "px) translateX(-50%)";
|
||||
|
||||
});
|
13
v2.css
13
v2.css
@ -287,8 +287,8 @@ input:focus {
|
||||
color: #222;
|
||||
font-size: 36px;
|
||||
font-weight: 700;
|
||||
top: -200px;;
|
||||
right: 40vw;
|
||||
top: 480px;;
|
||||
right: 30vw;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
@ -297,6 +297,7 @@ input:focus {
|
||||
border-radius: 10px;
|
||||
padding-top: 20px;
|
||||
cursor: pointer;
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
.scroll-link-icon {
|
||||
@ -355,6 +356,12 @@ input:focus {
|
||||
color: rgba(0,0,0,0.05)
|
||||
}
|
||||
|
||||
.below-fold {
|
||||
background-color: var(--main-color);
|
||||
padding-top: 200px;
|
||||
padding-bottom: 200px;
|
||||
}
|
||||
|
||||
.skewed-bg {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
@ -386,7 +393,7 @@ input:focus {
|
||||
/*Animations*/
|
||||
|
||||
.translate {
|
||||
|
||||
transition: all .8s cubic-bezier( 0.39, 0.575, 0.565, 1 );
|
||||
}
|
||||
|
||||
|
||||
|
26
v2.html
26
v2.html
@ -10,7 +10,9 @@
|
||||
<title>Tben Design</title>
|
||||
<meta name="description" content="Web/Graphic/Motion Designer, UI UX Designer, Frontend Web Developer">
|
||||
<link rel="shortcut icon" type="image/x-icon" href="/images-dw/favicon.ico">
|
||||
<link href="https://fonts.googleapis.com/css?family=Lato:400,500,700,800|Impact|Satisfy" rel="stylesheet">
|
||||
<link href="https://fonts.googleapis.com/css?family=Lato:400,500,700,800|Impact" rel="stylesheet">
|
||||
<link href="http://fonts.cdnfonts.com/css/impacted" rel="stylesheet">
|
||||
|
||||
<link rel="stylesheet" href="v2.css">
|
||||
|
||||
</head>
|
||||
@ -44,7 +46,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="hero-text-wrapper">
|
||||
<div class="hero-text-wrapper translate" data-speed=".2">
|
||||
<div class="hero-text-block">
|
||||
Hi. I'm a
|
||||
<h1>
|
||||
@ -65,27 +67,27 @@
|
||||
|
||||
|
||||
|
||||
<div class="hero-watermark" data-speed=".2">T-BEN</div>
|
||||
<div class="hero-watermark" data-speed=".6">T-BEN</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<section style="background-color:var(--main-color);" class="translate" data-speed=".15">
|
||||
<div class="scroll-down-link-block">
|
||||
<div class="scroll-link-icon">›</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<section class="below-fold translate" data-speed=".1">
|
||||
<div>
|
||||
<div class="container-darkbg">
|
||||
<div class="container-darkbg translate" data-speed="0">
|
||||
<h2>Some of my Work</h2>
|
||||
<p style="width: 350px;">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Quis ipsum suspendisse ultrices gravida. Risus commodo viverra maecenas accumsan lacus vel facilisis.</p>
|
||||
</div>
|
||||
<div></div>
|
||||
</div>
|
||||
<div class="skewed-bg" data-speed=".6"></div>
|
||||
<div class="skewed-bg"></div>
|
||||
</section>
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user