diff --git a/Calculators/Falling-under-gravity-calculator/README.md b/Calculators/Falling-under-gravity-calculator/README.md new file mode 100644 index 000000000..f31986031 --- /dev/null +++ b/Calculators/Falling-under-gravity-calculator/README.md @@ -0,0 +1,16 @@ +#

Falling Object Under Gravity Calculator

+ +## Description :- + +This calculator estimates the time and speed of a free-falling object under gravity (9.81 m/s²), neglecting air resistance. + +## Tech Stacks :- + +- HTML +- CSS +- JavaScript + +## Screenshots :- + + +![Screenshot 2024-08-10 180118](https://github.com/user-attachments/assets/8ad73eb9-36dc-44f0-abd1-61d974a7d382) diff --git a/Calculators/Falling-under-gravity-calculator/index.html b/Calculators/Falling-under-gravity-calculator/index.html new file mode 100644 index 000000000..d8c35a63c --- /dev/null +++ b/Calculators/Falling-under-gravity-calculator/index.html @@ -0,0 +1,27 @@ + + + + + + Falling Object Under Gravity Calculator + + + +
+

Falling Object Calculator

+
+ + +
+ +
+
+ This calculator estimates the time and speed of a free-falling object under gravity (9.81 m/s²), neglecting air resistance. +
+
+
+
+
+ + + diff --git a/Calculators/Falling-under-gravity-calculator/script.js b/Calculators/Falling-under-gravity-calculator/script.js new file mode 100644 index 000000000..b1d22f51a --- /dev/null +++ b/Calculators/Falling-under-gravity-calculator/script.js @@ -0,0 +1,22 @@ +function calculate() { + const g = 9.81; // Acceleration due to gravity (m/s^2) + const heightInput = document.getElementById('height'); + const resultDiv = document.getElementById('result'); + + const height = parseFloat(heightInput.value); + + if (isNaN(height) || height < 0) { + resultDiv.innerHTML = 'Please enter a valid height.'; + resultDiv.style.color = '#dc3545'; // Change color to red for error + return; + } + + const time = Math.sqrt((2 * height) / g); + const speed = g * time; + + resultDiv.style.color = '#28a745'; // Change color to green for valid result + resultDiv.innerHTML = ` +

Time to fall: ${time.toFixed(2)} seconds

+

Speed: ${speed.toFixed(2)} m/s

+ `; +} diff --git a/Calculators/Falling-under-gravity-calculator/style.css b/Calculators/Falling-under-gravity-calculator/style.css new file mode 100644 index 000000000..78788ee76 --- /dev/null +++ b/Calculators/Falling-under-gravity-calculator/style.css @@ -0,0 +1,154 @@ +body { + font-family: 'Arial', sans-serif; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + min-height: 100vh; + background: linear-gradient(to right, #6b11cbb6, #fc2594); + color: #333; + overflow: auto; + } + + .container { + background-color: #ffffff41; + padding: 60px 80px; + border-radius: 20px; + box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3); + text-align: center; + width: 600px; + max-width: 90%; + position: relative; + overflow: auto; + } + + h1 { + color: #333; + margin-bottom: 30px; + font-size: 3em; + text-shadow: 0 3px 6px rgba(0, 0, 0, 0.2); + text-align: center; + font-weight: bold; + letter-spacing: 2px; + } + + .input-group { + display: flex; + flex-direction: column; + margin-bottom: 20px; + } + + .input-group label { + margin-bottom: 5px; + font-weight: bold; + font-size: 1.2em; + } + + input[type="number"] { + width: calc(100% - 22px); + padding: 15px; + margin: 10px 0; + border: 1px solid #ccc; + border-radius: 8px; + box-sizing: border-box; + font-size: 18px; + transition: border-color 0.3s ease; + } + + input[type="number"]:focus { + outline: none; + border-color: #007bff; + box-shadow: 0 0 5px #007bff; + } + + button { + background-color: #007bff; + color: white; + padding: 15px 30px; + border: none; + border-radius: 8px; + cursor: pointer; + font-size: 18px; + font-weight: bold; + transition: background-color 0.3s ease, transform 0.1s ease; + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); + } + + button:hover { + background-color: #0056b3; + transform: translateY(-3px); + box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2); + } + + #result { + margin-top: 40px; + font-size: 2.2em; + font-weight: bold; + color: #28a745; + text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); + animation: blink 1.2s infinite; + } + + @keyframes blink { + 0% { opacity: 1; } + 50% { opacity: 0.7; } + 100% { opacity: 1; } + } + + .explanation { + margin-top: 30px; + font-size: 1.1em; + color: #df4941; + line-height: 1.6; + } + + .animation-container { + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + width: 100%; + height: 100%; + pointer-events: none; + z-index: -1; + } + + .animation-circle { + position: absolute; + width: 150px; + height: 150px; + border-radius: 50%; + background-color: rgba(255, 255, 255, 0.2); + animation: circleAnimation 7s linear infinite; + } + + @keyframes circleAnimation { + 0% { + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + opacity: 1; + } + 100% { + top: 10%; + left: 90%; + transform: translate(-50%, -50%) scale(2.5); + opacity: 0.05; + } + } + + /* Responsive Design (adjust for different screen sizes) */ + @media (max-width: 600px) { + .container { + width: 90%; + padding: 40px 20px; + } + h1 { + font-size: 2.2em; + } + .animation-circle { + width: 100px; + height: 100px; + } + } + diff --git a/index.html b/index.html index e572db610..33ea4a80a 100644 --- a/index.html +++ b/index.html @@ -2117,6 +2117,20 @@

Calculates the factorial of any large number instantly.

+
+
+

Falling Object Under Gravity Calculator

+

Calculates the time and speed of a free-falling object under gravity.

+ +
+

Fascinating Number Calculator