Happy PI Day

Size
2,402 Kb
Views
18,216

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 Previews

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();
Happy PI Day - Script Codes
Happy PI Day - Script Codes
Home Page Home
Developer André Michelle
Username andremichelle
Uploaded October 18, 2022
Rating 3
Size 2,402 Kb
Views 18,216
Do you need developer help for Happy PI Day?

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!

André Michelle (andremichelle) Script Codes
Create amazing sales emails with AI!

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!