Happy PI Day
How do I make an happy pi day?
Gregory–Leibniz series to approximate PI.http://en.wikipedia.org/wiki/Approximations_of_%CF%80#Gregory.E2.80.93Leibniz_series. What is a happy pi day? How do you make a happy pi day? This script and codes were developed by André Michelle on 18 October 2022, Tuesday.
Happy PI Day - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Happy PI Day</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="stage"> <h1>π approximation</h1> <h2>Gregory–Leibniz Series</h2> <div><span>Pi</span><span id="PI"></span></div> <div><span>Iterations</span><span id="COUNT"></span></div> <div><span>Rate</span><input id="RATE" type="range" min="1" max="11177" step="1" value="1"></div> <h3>Happy π day!</h3>
</div> <script src="js/index.js"></script>
</body>
</html>
Happy PI Day - Script Codes CSS Codes
html, body { margin: 0; padding: 0; color: #782F10; background: #90C468;
}
.stage { position: absolute; top: 50%; left: 50%; width: 256px; padding: 32px; background: #C4E8A9; border-radius: 32px; transform: translateX(-50%) translateY(-50%); -webkit-transform: translateX(-50%) translateY(-50%); font-size: 13px; font-family: "Open Sans";
}
.stage h1 { color: #782F10; margin: 4px 0 0 0; padding: 0; font-size: 16px; font-weight: bold;
}
.stage h2 { color: #782F10; margin: 0 0 24px 0; padding: 0; font-size: 12.4px;
}
.stage h3 { color: #782F10; margin: 16px 0 0 0; padding: 0; font-size: 13px; font-weight: bold;
}
.stage span:first-child { color: #451500; width: 33%; display: inline-block;
}
.stage input { display: inline; vertical-align: middle; -webkit-appearance: none; height: 8px; background: #DC9475; overflow: hidden; outline: none;
}
.stage input::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; background: #782F10; position: relative; z-index: 3;
}
.stage input::-webkit-slider-thumb:after { content: " "; position: absolute; z-index: 1; background: #782F10;
}
Happy PI Day - Script Codes JS Codes
var pi = document.getElementById("PI");
var count = document.getElementById("COUNT");
var rate = document.getElementById("RATE");
var s = 1;
var i = 0;
var pi4 = 0.0;
var next = function() { var n = rate.value; for(var c = 0 ; c < n ; ++c ) { pi4 += 1.0 / ( s * ( i * 2.0 + 1.0 ) ); i++; s = 1 == s ? -1 : 1; pi.textContent = 4.0 * pi4; count.textContent = i; } window.requestAnimationFrame( next );
}
next();
Developer | André Michelle |
Username | andremichelle |
Uploaded | October 18, 2022 |
Rating | 3 |
Size | 2,402 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 |
Battery Api | 2,899 Kb |
X0X Clap | 2,825 Kb |
Geolocation Api | 2,322 Kb |
Time Displacement | 2,617 Kb |
Sonic Brain Food | 2,234 Kb |
Web Audio Api Convolver | 3,023 Kb |
Calculating Pi with Virtual Darts | 2,389 Kb |
Web Audio Api Equalizer | 2,606 Kb |
Fourier series | 2,989 Kb |
Web Audio Api MultiBandCompressor | 3,553 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 |
Simple Buttons | Haydenmills | 1,750 Kb |
JS Beispiel getElementsByClassName 3 | HSZG-Frontend-Kurs | 1,988 Kb |
Countdown Timer | Massiebn | 3,001 Kb |
Reviews and Ratings Star | Zbnmstry | 1,591 Kb |
A Pen by Oliver Schafeld | Schafeld | 1,720 Kb |
Draggables in pure angular | Rlo206 | 5,167 Kb |
Using Flickr API | MoyArt | 6,761 Kb |
Impress JS Algorhytmic Generator | Jeffscottward | 7,906 Kb |
My three.js practice | Esambino | 3,203 Kb |
Infractions - Attitude | Kylie_Joseph | 7,672 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!