Countdown with Rings
How do I make an countdown with rings?
Forked from Larry Williamson's Pen Countdown Rings.. What is a countdown with rings? How do you make a countdown with rings? This script and codes were developed by Noel Peña on 04 November 2022, Friday.
Countdown with Rings - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Countdown with Rings</title>
</head>
<body> <div class="countdownwrap"></div> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Countdown with Rings - Script Codes JS Codes
var ringer = { countdown_to: "10/10/2018", rings: { 'DAYS': { s: 86400000, // mseconds in a day, max: 365 }, 'HOURS': { s: 3600000, // mseconds per hour, max: 24 }, 'MINUTES': { s: 60000, // mseconds per minute max: 60 }, 'SECONDS': { s: 1000, max: 60 }, 'MICROSEC': { s: 10, max: 100 } }, r_count: 5, r_spacing: 10, // px r_size: 100, // px r_thickness: 5, // px update_interval: 11, // ms init: function(){ $r = ringer; $r.cvs = document.createElement('canvas'); $r.size = { w: ($r.r_size + $r.r_thickness) * $r.r_count + ($r.r_spacing*($r.r_count-1)), h: ($r.r_size + $r.r_thickness) }; $r.cvs.setAttribute('width',$r.size.w); $r.cvs.setAttribute('height',$r.size.h); $r.ctx = $r.cvs.getContext('2d'); $(".countdownwrap").append($r.cvs); $r.cvs = $($r.cvs); $r.ctx.textAlign = 'center'; $r.actual_size = $r.r_size + $r.r_thickness; $r.countdown_to_time = new Date($r.countdown_to).getTime(); $r.cvs.css({ width: $r.size.w+"px", height: $r.size.h+"px" }); $r.go(); }, ctx: null, go: function(){ var idx=0; $r.time = (new Date().getTime()) - $r.countdown_to_time; for(var r_key in $r.rings) $r.unit(idx++,r_key,$r.rings[r_key]); setTimeout($r.go,$r.update_interval); }, unit: function(idx,label,ring) { var x,y, value, ring_secs = ring.s; value = parseFloat($r.time/ring_secs); $r.time-=Math.round(parseInt(value)) * ring_secs; value = Math.abs(value); x = ($r.r_size*.5 + $r.r_thickness*.5); x +=+(idx*($r.r_size+$r.r_spacing+$r.r_thickness)); y = $r.r_size*.5; y += $r.r_thickness*.5; // calculate arc end angle var degrees = 360-(value / ring.max) * 360.0; var endAngle = degrees * (Math.PI / 180); $r.ctx.save(); $r.ctx.translate(x,y); $r.ctx.clearRect($r.actual_size*-0.5,$r.actual_size*-0.5,$r.actual_size,$r.actual_size); // first circle $r.ctx.strokeStyle = "rgba(128,128,128,0.2)"; $r.ctx.beginPath(); $r.ctx.arc(0,0,$r.r_size/2,0,2 * Math.PI, 2); $r.ctx.lineWidth =$r.r_thickness; $r.ctx.stroke(); // second circle $r.ctx.strokeStyle = "rgba(253, 128, 1, 0.9)"; $r.ctx.beginPath(); $r.ctx.arc(0,0,$r.r_size/2,0,endAngle, 1); $r.ctx.lineWidth =$r.r_thickness; $r.ctx.stroke(); // label $r.ctx.fillStyle = "#000000"; $r.ctx.font = '12px Helvetica'; $r.ctx.fillText(label, 0, 23); $r.ctx.fillText(label, 0, 23); $r.ctx.font = 'bold 40px Helvetica'; $r.ctx.fillText(Math.floor(value), 0, 10); $r.ctx.restore(); }
}
ringer.init();
Developer | Noel Peña |
Username | ewganoel |
Uploaded | November 04, 2022 |
Rating | 4 |
Size | 2,490 Kb |
Views | 18,216 |
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 |
T3sting | 1,807 Kb |
Google Maps JS API | 1,923 Kb |
Membership Levels Redesign | 3,711 Kb |
EWGA PerksTable | 6,492 Kb |
Tryout.Flexbox | 3,682 Kb |
LB JS | 3,410 Kb |
Mailchimp embed | 2,303 Kb |
Grayscale Filter - Hover to normal | 1,674 Kb |
NWGA | 2,841 Kb |
FAQs with Toggle - CSS Only | 1,894 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 |
Menubar compass mixin | Michaelparenteau | 4,925 Kb |
Mobile Sub Menu Concept | Berdejitendra | 2,790 Kb |
Project MMetro beta | Atomicsong | 5,157 Kb |
Tumblr API | Juanv911 | 2,436 Kb |
Pure CSS Torch Light | Juliendargelos | 2,727 Kb |
Subscription Newsletter - Before inlining | Bradstrong | 7,526 Kb |
Parallax scrolling scene | Iharosi | 2,485 Kb |
DevCamp 2014 - Denver Public Library | See8ch | 5,033 Kb |
Css3 slide | Nakome | 3,190 Kb |
Drill-down Map | Good886 | 8,484 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!