Skip to content

Instantly share code, notes, and snippets.

@wpflames
Created August 28, 2020 15:48
Show Gist options
  • Save wpflames/8f939afc3267c4ef8c36ff0bcdb1e792 to your computer and use it in GitHub Desktop.
Save wpflames/8f939afc3267c4ef8c36ff0bcdb1e792 to your computer and use it in GitHub Desktop.
Landing Page with GSAP Animations - JS
const hero = document.querySelector('.hero');
const slider = document.querySelector('.slider');
const logo = document.querySelector('#logo');
const hamburger = document.querySelector('.hamburger');
const headline = document.querySelector('.headline');
const cta = document.querySelector('.cta');
const numwrapper = document.querySelector('.num-wrapper');
var tl = gsap.timeline();
tl.fromTo(
hero,
1,
{height: "0%"},
{height: "100%", ease: Power3.easeInOut}
).fromTo(
hero, 1.2,
{width: "100%"},
{width: "80%", ease: Power3.easeInOut}
)
.fromTo(
slider,
1.2,
{ x: "-100%"},
{x: "-24%", ease: Power3.easeInOut},
"-=1.2"
)
.fromTo(
logo,
0.5,
{opacity: 0, y: -100},
{opacity: 1, y: 0},
"-=0.5"
)
.fromTo(
hamburger,
0.5,
{opacity: 0, y: -100},
{opacity: 1, y: 0},
"-=0.5"
)
.fromTo(
cta,
0.5,
{opacity: 0, y: -100},
{opacity: 1, y: 0},
"-=0.5"
)
.fromTo(
numwrapper,
0.5,
{opacity: 0, y: -100},
{opacity: 1, y: 0},
"-=0.5"
)
.fromTo(
headline,
0.5,
{opacity: 0, y: -100},
{opacity: 1, y: 0},
"-=0.5"
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment