Simple scroll controlled animation
How do I make an simple scroll controlled animation?
GreenSock forums:http://greensock.com/forums/topic/11171-fade-in-on-scroll/. What is a simple scroll controlled animation? How do you make a simple scroll controlled animation? This script and codes were developed by Rodrigo Hernando on 18 November 2022, Friday.
Simple scroll controlled animation - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Simple scroll controlled animation</title> <style> /* NOTE: The styles were added inline because Prefixfree needs access to your styles and they must be inlined if they are on local disk! */ html,body{ margin:0; padding:0;
}
.height-marker{ height:2000px; width:1px; position:absolute; visibility:hidden;
}
#target{ width:300px; height:50px; background:blue; position:fixed; margin:50px; border-radius:10px;
} </style> <script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
</head>
<body> <div id="target"></div>
<div class="height-marker"></div> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/gsap/1.15.0/TweenMax.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Simple scroll controlled animation - Script Codes CSS Codes
html,body{ margin:0; padding:0;
}
.height-marker{ height:2000px; width:1px; position:absolute; visibility:hidden;
}
#target{ width:300px; height:50px; background:blue; position:fixed; margin:50px; border-radius:10px;
}
Simple scroll controlled animation - Script Codes JS Codes
var t = TweenLite.from("#target", 1,{ autoAlpha:0, x:150, paused:true, ease:Linear.easeNone
}), scrollThreshold = {"start":201, "stop":600};
$(window).on("scroll",function(e){ var currentScroll = $(window).scrollTop(), currentProgress = ( currentScroll - scrollThreshold.start ) / ( scrollThreshold.stop - scrollThreshold.start ); if(currentScroll > scrollThreshold.start && currentScroll < scrollThreshold.stop){ t.progress(currentProgress); }else if( currentScroll < scrollThreshold.start ){ t.progress(0); }else if( currentScroll < scrollThreshold.stop ){ t.progress(1); }
});
Developer | Rodrigo Hernando |
Username | rhernando |
Uploaded | November 18, 2022 |
Rating | 3 |
Size | 2,229 Kb |
Views | 10,120 |
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 |
Toggle Tween Direction | 2,325 Kb |
Simple Interactive 3D Cube | 2,985 Kb |
Circular Progress Bar | 4,985 Kb |
Auto scroll to element offset 2 | 2,620 Kb |
Spinning Images | 2,279 Kb |
Cross-Browser Flip Card | 2,396 Kb |
Greensock Swipe Slides | 4,201 Kb |
Transform Orign | 2,051 Kb |
Circular Bezier | 2,696 Kb |
Update tween progress with Draggable | 2,695 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 |
Mini Profile | Frytyler | 3,828 Kb |
CSS3 Media Queries demo | Machal | 1,824 Kb |
Wave Lines | Mikehobizal | 4,023 Kb |
Testing Code Pen | Jduprey | 1,468 Kb |
Print element on a page | Mrs_snow | 2,081 Kb |
CSS Link Zoom On Click | Bryce | 1,960 Kb |
TweetBox with React JS | J0zelito | 3,325 Kb |
CSS3 Butterfly | Timohausmann | 3,430 Kb |
Flex Table | Simeonoff | 4,059 Kb |
Two Element Typeface | Chrisota | 4,942 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!