Scroll Progress as Canvas to Favicon
How do I make an scroll progress as canvas to favicon?
NOTE: Due to iframes and such on CodePen, you'll have to use the Debug view mode to see the favicon update: http://s.codepen.io/jackrugile/debug/vGKWem. What is a scroll progress as canvas to favicon? How do you make a scroll progress as canvas to favicon? This script and codes were developed by Jack Rugile on 09 January 2023, Monday.
Scroll Progress as Canvas to Favicon - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Scroll Progress as Canvas to Favicon</title> <link rel="shortcut icon" type="image/x-icon" href="#" class="favicon"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css"> <link rel="stylesheet" href="css/style.css">
</head>
<body> <!--
NOTE: Due to iframes and such on CodePen, you'll have to use the Debug view mode to see the favicon update:
https://s.codepen.io/jackrugile/debug/vGKWem
--> <script src="js/index.js"></script>
</body>
</html>
Scroll Progress as Canvas to Favicon - Script Codes CSS Codes
body { height: 4000px;
}
canvas { bottom: 0; left: 0; margin: auto; position: fixed; right: 0; top: 0;
}
Scroll Progress as Canvas to Favicon - Script Codes JS Codes
var favicon = document.querySelector( '.favicon' ), c = document.createElement( 'canvas' ), ctx = c.getContext( '2d' ), w = h = c.width = c.height = 32, lineWidth = 6, prog = 0, progTarget = 0, TAU = Math.PI * 2;
function loop() { requestAnimationFrame( loop ); progTarget = window.scrollY / ( document.body.offsetHeight - window.innerHeight ); prog += ( progTarget - prog ) * 0.4; ctx.clearRect( 0, 0, w, h ); ctx.beginPath(); ctx.arc( w / 2, h / 2, w / 2 - lineWidth / 2, 0, TAU ); ctx.lineWidth = lineWidth; ctx.strokeStyle = 'hsla(0, 0%, 0%, 0.1)'; ctx.stroke(); ctx.beginPath(); ctx.arc( w / 2, h / 2, w / 2 - lineWidth / 2, -Math.PI / 2, -Math.PI / 2 + prog * TAU ); ctx.strokeStyle = 'hsla(0, 0%, 0%, 0.7)'; ctx.stroke(); favicon.setAttribute( 'href', c.toDataURL() );
}
loop();
document.body.appendChild( c );
Developer | Jack Rugile |
Username | jackrugile |
Uploaded | January 09, 2023 |
Rating | 4.5 |
Size | 2,407 Kb |
Views | 12,144 |
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 |
Canvas Simple Circle Loader | 2,946 Kb |
Bouncing Ball Animation | 1,952 Kb |
SpacePi js13k | 19,847 Kb |
Rainbow Grid | 2,760 Kb |
CSS3 Pseudo Sound Bars | 2,400 Kb |
Glowing Pulse Form | 2,542 Kb |
Canvas Color Smoke | 3,446 Kb |
Abstract Canvas Visualization | 3,459 Kb |
Develop Denver Logo | 3,813 Kb |
Canvas Orbital Trails | 3,697 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 |
Parallax scrolling scene | Iharosi | 2,485 Kb |
Animated Slide Hamburger Mobile Menu | BJack | 2,247 Kb |
Freecodecamp - Tribute Page | Samoht513 | 3,583 Kb |
Scroll to view if element partially out of view port height | ChrisMaki | 2,104 Kb |
A Pen by Alexandru Pora | Axpro | 1,615 Kb |
Vanilla JS - A toggleClass function | Woodwork | 2,532 Kb |
Project -Show the Local Weather | Luciano_Britis | 2,583 Kb |
Spilled Paint | Darrylhuffman | 3,894 Kb |
Day 11 - Calendar Card | Arnellebalane | 6,984 Kb |
LAMP PURE CSS with Animation | Dam62500 | 2,911 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!