Animate items in and out of Viewport on Scroll | Greensock
How do I make an animate items in and out of viewport on scroll | greensock?
Animating things with scrolling is awesome! And here I explain how I've done all of this: http://codepen.io/aderaaij/post/animating-elements-in-and-out-of-the-viewport-on-scroll-with-js-and-greensock. What is a animate items in and out of viewport on scroll | greensock? How do you make a animate items in and out of viewport on scroll | greensock? This script and codes were developed by Arden on 19 November 2022, Saturday.
Animate items in and out of Viewport on Scroll | Greensock - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Animate items in and out of Viewport on Scroll | Greensock</title> <script src="https://use.typekit.net/vms5sey.js"></script>
<script>try{Typekit.load({ async: true });}catch(e){}</script> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <link rel="stylesheet" href="css/style.css">
</head>
<body>
<div class="container"> <article class="excerpt"> <div class="excerpt__inner"> <figure class="excerpt__image" style="background-image:url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/22914/6850716805_05b85349fa_b.jpg)"></figure> <div class="excerpt__content"> <h1 class="excerpt__title">Good stuff happening</h1> <div class="excerpt__entryContent"> <p>Just waking up in the morning gotta thank God I don't know but today seems kinda odd No barking from the dogs, no smog And momma cooked a breakfast with no hog. I got my grub on, but didn't pig out. Finally got a call from a girl want to dig out. Hooked it up on later as I hit the do', Thinking will i live another twenty fo'. I gotta go cause I got me a drop top And if I hit the switch, I can make the ass drop. Had to stop at a red light. Looking in my mirror not a jacker in sight And everything is alright.</p> </div> </div> </div> </article> <article class="excerpt"> <div class="excerpt__inner"> <figure class="excerpt__image" style="background-image:url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/22914/6850716805_05b85349fa_b.jpg)"></figure> <div class="excerpt__content"> <h1 class="excerpt__title">Good stuff happening</h1> <div class="excerpt__entryContent"> <p>Just waking up in the morning gotta thank God I don't know but today seems kinda odd No barking from the dogs, no smog And momma cooked a breakfast with no hog. I got my grub on, but didn't pig out. Finally got a call from a girl want to dig out. Hooked it up on later as I hit the do', Thinking will i live another twenty fo'. I gotta go cause I got me a drop top And if I hit the switch, I can make the ass drop. Had to stop at a red light. Looking in my mirror not a jacker in sight And everything is alright.</p> </div> </div> </div> </article> <article class="excerpt"> <div class="excerpt__inner"> <figure class="excerpt__image" style="background-image:url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/22914/6850716805_05b85349fa_b.jpg)"></figure> <div class="excerpt__content"> <h1 class="excerpt__title">Good stuff happening</h1> <div class="excerpt__entryContent"> <p>Just waking up in the morning gotta thank God I don't know but today seems kinda odd No barking from the dogs, no smog And momma cooked a breakfast with no hog. I got my grub on, but didn't pig out. Finally got a call from a girl want to dig out. Hooked it up on later as I hit the do', Thinking will i live another twenty fo'. I gotta go cause I got me a drop top And if I hit the switch, I can make the ass drop. Had to stop at a red light. Looking in my mirror not a jacker in sight And everything is alright.</p> </div> </div> </div> </article> <article class="excerpt"> <div class="excerpt__inner"> <figure class="excerpt__image" style="background-image:url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/22914/6850716805_05b85349fa_b.jpg)"></figure> <div class="excerpt__content"> <h1 class="excerpt__title">Good stuff happening</h1> <div class="excerpt__entryContent"> <p>Just waking up in the morning gotta thank God I don't know but today seems kinda odd No barking from the dogs, no smog And momma cooked a breakfast with no hog. I got my grub on, but didn't pig out. Finally got a call from a girl want to dig out. Hooked it up on later as I hit the do', Thinking will i live another twenty fo'. I gotta go cause I got me a drop top And if I hit the switch, I can make the ass drop. Had to stop at a red light. Looking in my mirror not a jacker in sight And everything is alright.</p> </div> </div> </div> </article> <article class="excerpt"> <div class="excerpt__inner"> <figure class="excerpt__image" style="background-image:url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/22914/6850716805_05b85349fa_b.jpg)"></figure> <div class="excerpt__content"> <h1 class="excerpt__title">Good stuff happening</h1> <div class="excerpt__entryContent"> <p>Just waking up in the morning gotta thank God I don't know but today seems kinda odd No barking from the dogs, no smog And momma cooked a breakfast with no hog. I got my grub on, but didn't pig out. Finally got a call from a girl want to dig out. Hooked it up on later as I hit the do', Thinking will i live another twenty fo'. I gotta go cause I got me a drop top And if I hit the switch, I can make the ass drop. Had to stop at a red light. Looking in my mirror not a jacker in sight And everything is alright.</p> </div> </div> </div> </article> <article class="excerpt"> <div class="excerpt__inner"> <figure class="excerpt__image" style="background-image:url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/22914/6850716805_05b85349fa_b.jpg)"></figure> <div class="excerpt__content"> <h1 class="excerpt__title">Good stuff happening</h1> <div class="excerpt__entryContent"> <p>Just waking up in the morning gotta thank God I don't know but today seems kinda odd No barking from the dogs, no smog And momma cooked a breakfast with no hog. I got my grub on, but didn't pig out. Finally got a call from a girl want to dig out. Hooked it up on later as I hit the do', Thinking will i live another twenty fo'. I gotta go cause I got me a drop top And if I hit the switch, I can make the ass drop. Had to stop at a red light. Looking in my mirror not a jacker in sight And everything is alright.</p> </div> </div> </div> </article> <article class="excerpt"> <div class="excerpt__inner"> <figure class="excerpt__image" style="background-image:url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/22914/6850716805_05b85349fa_b.jpg)"></figure> <div class="excerpt__content"> <h1 class="excerpt__title">Good stuff happening</h1> <div class="excerpt__entryContent"> <p>Just waking up in the morning gotta thank God I don't know but today seems kinda odd No barking from the dogs, no smog And momma cooked a breakfast with no hog. I got my grub on, but didn't pig out. Finally got a call from a girl want to dig out. Hooked it up on later as I hit the do', Thinking will i live another twenty fo'. I gotta go cause I got me a drop top And if I hit the switch, I can make the ass drop. Had to stop at a red light. Looking in my mirror not a jacker in sight And everything is alright.</p> </div> </div> </div> </article> <article class="excerpt"> <div class="excerpt__inner"> <figure class="excerpt__image" style="background-image:url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/22914/6850716805_05b85349fa_b.jpg)"></figure> <div class="excerpt__content"> <h1 class="excerpt__title">Good stuff happening</h1> <div class="excerpt__entryContent"> <p>Just waking up in the morning gotta thank God I don't know but today seems kinda odd No barking from the dogs, no smog And momma cooked a breakfast with no hog. I got my grub on, but didn't pig out. Finally got a call from a girl want to dig out. Hooked it up on later as I hit the do', Thinking will i live another twenty fo'. I gotta go cause I got me a drop top And if I hit the switch, I can make the ass drop. Had to stop at a red light. Looking in my mirror not a jacker in sight And everything is alright.</p> </div> </div> </div> </article> <article class="excerpt"> <div class="excerpt__inner"> <figure class="excerpt__image" style="background-image:url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/22914/6850716805_05b85349fa_b.jpg)"></figure> <div class="excerpt__content"> <h1 class="excerpt__title">Good stuff happening</h1> <div class="excerpt__entryContent"> <p>Just waking up in the morning gotta thank God I don't know but today seems kinda odd No barking from the dogs, no smog And momma cooked a breakfast with no hog. I got my grub on, but didn't pig out. Finally got a call from a girl want to dig out. Hooked it up on later as I hit the do', Thinking will i live another twenty fo'. I gotta go cause I got me a drop top And if I hit the switch, I can make the ass drop. Had to stop at a red light. Looking in my mirror not a jacker in sight And everything is alright.</p> </div> </div> </div> </article> <article class="excerpt"> <div class="excerpt__inner"> <figure class="excerpt__image" style="background-image:url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/22914/6850716805_05b85349fa_b.jpg)"></figure> <div class="excerpt__content"> <h1 class="excerpt__title">Good stuff happening</h1> <div class="excerpt__entryContent"> <p>Just waking up in the morning gotta thank God I don't know but today seems kinda odd No barking from the dogs, no smog And momma cooked a breakfast with no hog. I got my grub on, but didn't pig out. Finally got a call from a girl want to dig out. Hooked it up on later as I hit the do', Thinking will i live another twenty fo'. I gotta go cause I got me a drop top And if I hit the switch, I can make the ass drop. Had to stop at a red light. Looking in my mirror not a jacker in sight And everything is alright.</p> </div> </div> </div> </article> <article class="excerpt"> <div class="excerpt__inner"> <figure class="excerpt__image" style="background-image:url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/22914/6850716805_05b85349fa_b.jpg)"></figure> <div class="excerpt__content"> <h1 class="excerpt__title">Good stuff happening</h1> <div class="excerpt__entryContent"> <p>Just waking up in the morning gotta thank God I don't know but today seems kinda odd No barking from the dogs, no smog And momma cooked a breakfast with no hog. I got my grub on, but didn't pig out. Finally got a call from a girl want to dig out. Hooked it up on later as I hit the do', Thinking will i live another twenty fo'. I gotta go cause I got me a drop top And if I hit the switch, I can make the ass drop. Had to stop at a red light. Looking in my mirror not a jacker in sight And everything is alright.</p> </div> </div> </div> </article> <article class="excerpt"> <div class="excerpt__inner"> <figure class="excerpt__image" style="background-image:url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/22914/6850716805_05b85349fa_b.jpg)"></figure> <div class="excerpt__content"> <h1 class="excerpt__title">Good stuff happening</h1> <div class="excerpt__entryContent"> <p>Just waking up in the morning gotta thank God I don't know but today seems kinda odd No barking from the dogs, no smog And momma cooked a breakfast with no hog. I got my grub on, but didn't pig out. Finally got a call from a girl want to dig out. Hooked it up on later as I hit the do', Thinking will i live another twenty fo'. I gotta go cause I got me a drop top And if I hit the switch, I can make the ass drop. Had to stop at a red light. Looking in my mirror not a jacker in sight And everything is alright.</p> </div> </div> </div> </article>
</div> <script src='http://cdnjs.cloudflare.com/ajax/libs/gsap/1.18.0/TweenMax.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Animate items in and out of Viewport on Scroll | Greensock - Script Codes CSS Codes
* { box-sizing: border-box;
}
body { color: #444;
}
h1, h2, h3, h4, h5, h6 { font-family: 'industry', sans-serif; font-weight: 300;
}
.container { max-width: 1200px; margin: 0 auto; padding: 2em 1.25em;
}
@media (min-width: 960px) { .container { padding: 0em 1.25em; }
}
.excerpt { height: auto; width: 100%; margin-bottom: 1.25em;
}
@media (min-width: 960px) { .excerpt { height: 400px; width: 100%; margin-bottom: 0; }
}
.excerpt__inner { height: 100%; display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-orient: vertical; -webkit-box-direction: normal; -ms-flex-direction: column; flex-direction: column; position: relative; background-color: #ececec; border: 1px solid #ccc; box-shadow: 0 10px 20px rgba(0, 0, 0, 0.19), 0 6px 6px rgba(0, 0, 0, 0.23);
}
@media (min-width: 960px) { .excerpt__inner { -webkit-box-orient: horizontal; -webkit-box-direction: normal; -ms-flex-direction: row; flex-direction: row; box-shadow: none; }
}
.excerpt__image { width: 100%; height: 240px; background-color: #e1e1e1; margin: 0; background-size: cover; background-position: center;
}
@media (min-width: 960px) { .excerpt__image { width: 50%; height: 100%; }
}
.excerpt__content { width: 100%; padding: 1em 1.25em;
}
@media (min-width: 960px) { .excerpt__content { width: 50%; padding: 1em 2em; }
}
.excerpt__title { margin: 0;
}
.excerpt__entryContent { font-size: 0.875em; line-height: 1.5; display: none;
}
@media (min-width: 960px) { .excerpt__entryContent { display: block; }
}
Animate items in and out of Viewport on Scroll | Greensock - Script Codes JS Codes
var AnimateExcerpts = function() { var excerpts, excerptsInner var _init = function() { excerpts = document.querySelectorAll('.excerpt'); excerpts = Array.prototype.slice.call(excerpts); excerptsInner = document.querySelectorAll('.excerpt__inner'); excerptsInner = Array.prototype.slice.call(excerptsInner); _prepare(); _addEventHandlers(); _inView(); } var _addEventHandlers = function() { window.addEventListener('scroll', _inView, false); window.addEventListener('resize', _inView, false); } var _prepare = function() { TweenLite.set(excerptsInner, {transformPerspective: 900}) } var _inView = function() { excerpts.forEach(function(element,index) { _animateInOut(element, index); }); } var _animateInOut = function(element, index) { var inner = element.children[0]; var pos = element.getBoundingClientRect(); var elHeight = pos.height; var elBottomFromTop = pos.bottom; var elTopFromTop = pos.top; var elTopFromBottom = pos.top - window.innerHeight; var elBottomFromBottom = pos.bottom - window.innerHeight; if( elTopFromTop <= 0 && elBottomFromTop >= 0 ) { var transformOffset = (elTopFromTop / elHeight) * -50; TweenLite.to(inner, 0.3, { rotationX: transformOffset, transformOrigin: '50% 100%', ease:Power2.easeOut }); } else if( elTopFromBottom <= 0 && elBottomFromBottom >= 0 ) { var transformOffset = (elBottomFromBottom / elHeight) * -50; TweenLite.to(inner, 0.3, { rotationX: transformOffset, transformOrigin: '50% 0%', ease:Power2.easeOut }); } else { TweenLite.to(inner, 0.1, {rotationX:0, ease:Linear.easeNone}) } } return { init: _init }
}();
AnimateExcerpts.init();
Developer | Arden |
Username | aderaaij |
Uploaded | November 19, 2022 |
Rating | 4.5 |
Size | 4,718 Kb |
Views | 16,192 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
CFYE Profile Card | 4,819 Kb |
Mapbox Map with Animated Marker Icons | 12,296 Kb |
Responsive push menu with icon transform | 8,326 Kb |
Get slider data with the Fetch API | 7,015 Kb |
Sliding images gallery | 2,947 Kb |
Animated SVG logo Super Interactive | 4,015 Kb |
Vertical off-screen push menu | 6,697 Kb |
Vanilla JS Lightbox Slideshow | 11,123 Kb |
CSS Animated Background Gradient | 2,151 Kb |
Frontpage prototype with TheaterJS | 4,292 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
A Pen by Jason Kinney | Jason-kinney | 1,980 Kb |
Pagepilling.js | Blossk | 6,554 Kb |
A Pen by Rob Levin | Roblevin | 2,787 Kb |
Highbrow Basic HTML Lesson 7 | Kimlarocca | 1,662 Kb |
HTML5 Video Autoplay | Zivcos | 1,352 Kb |
Stylize Stories | Jvhti | 2,465 Kb |
Parallax.js | Zmeeey5 | 2,330 Kb |
A Pen by MurabitoB | MurabitoB | 4,421 Kb |
Hexagons | Ashmind | 4,360 Kb |
Amazing CSS Menu with Notification Badges | Faizanasad | 2,549 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!