-
Notifications
You must be signed in to change notification settings - Fork 396
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Momentum With Time Calculator (#1731)
- Loading branch information
1 parent
cff3dd5
commit 903aa05
Showing
5 changed files
with
185 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# <p align="center">Momentum With Time Calculator</p> | ||
|
||
## Description :- | ||
|
||
The Momentum With Time Calculator is a web application designed to calculate the momentum of an object or a body with its given force and time, dynamically on the webpage. | ||
|
||
## Tech Stacks :- | ||
|
||
- HTML | ||
- CSS | ||
- JavaScript | ||
|
||
## Features :- | ||
|
||
- Calculate the momentum of a body based on the user input. | ||
- Applicable to all types of units. | ||
- User-friendly interface with modern styling and animations. | ||
|
||
## How It Works :- | ||
|
||
1. **Input Force** | ||
- Enter the force of the body. | ||
|
||
2. **Input Time** | ||
- Enter the Time of the body. | ||
|
||
3. **Calculate Momentum** | ||
- Click the "Calculate" button to get the momentum. | ||
|
||
4. **Result** | ||
- The application will display the result of the calculation, i.e., the final momentum of the body. | ||
|
||
## Screenshots :- | ||
|
||
![Screenshot 2024-07-31 120129](https://github.com/user-attachments/assets/0f578db5-c877-487b-92c1-51a088ce3e02) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<link rel="stylesheet" href="style.css"> | ||
<title>Momentum With Time Calculator</title> | ||
</head> | ||
|
||
<body> | ||
<div class="calculator-container"> | ||
<h1>Momentum With Time Calculator</h1> | ||
<label for="force">Enter Force </label> | ||
<input type="number" id="force" placeholder="Enter force"> | ||
<br> | ||
<label for="time">Enter Time </label> | ||
<input type="number" id="time" placeholder="Enter change of time"> | ||
|
||
<button onclick="calculateM()">Calculate</button> | ||
|
||
<div id="result" class="result-container"></div> | ||
</div> | ||
<script src="script.js"></script> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
function calculateM() { | ||
// Get the input values | ||
var force = parseFloat(document.getElementById("force").value); | ||
var time = parseFloat(document.getElementById("time").value); | ||
|
||
// Validate input | ||
if (isNaN(force) || isNaN(time)) { | ||
alert("Please enter valid numbers."); | ||
return; | ||
} | ||
|
||
// Calculate momentum | ||
var mom = (force * time); | ||
|
||
// Display the result | ||
var resultElement = document.getElementById("result"); | ||
resultElement.innerHTML = ` | ||
<div class="result-details"> | ||
<div>Momentum: ${mom.toFixed(2)}</div> | ||
</div> | ||
`; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
body { | ||
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; | ||
background: linear-gradient(to bottom right, #3fbaf3, #b91149); | ||
margin: 0; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
height: 100vh; | ||
} | ||
|
||
.calculator-container { | ||
background-color: #fff; | ||
padding: 30px; | ||
border-radius: 12px; | ||
box-shadow: 0 0 20px rgba(0, 0, 0, 0.2); | ||
text-align: center; | ||
animation: fadeInUp 0.8s ease-out; | ||
} | ||
|
||
button { | ||
background-color: #4caf50; | ||
color: #fff; | ||
padding: 15px 30px; | ||
border: none; | ||
border-radius: 6px; | ||
cursor: pointer; | ||
font-size: 18px; | ||
margin-top: 20px; | ||
transition: background-color 0.3s ease, transform 0.2s ease-out; | ||
} | ||
|
||
button:hover { | ||
background-color: #45a049; | ||
transform: scale(1.05); | ||
} | ||
|
||
input, | ||
select { | ||
padding: 15px; | ||
margin: 15px 0; | ||
width: 80%; | ||
box-sizing: border-box; | ||
font-size: 18px; | ||
border: 1px solid #ccc; | ||
border-radius: 6px; | ||
transition: border-color 0.3s ease, transform 0.2s ease-out; | ||
} | ||
|
||
input:focus, | ||
select:focus { | ||
outline: none; | ||
border-color: #4caf50; | ||
transform: scale(1.02); | ||
} | ||
|
||
.result-container { | ||
font-size: 20px; | ||
font-weight: bold; | ||
color: #333; | ||
margin-top: 20px; | ||
animation: fadeIn 1s ease-out; | ||
} | ||
|
||
/* Animations */ | ||
@keyframes fadeInUp { | ||
from { | ||
opacity: 0; | ||
transform: translateY(20px); | ||
} | ||
|
||
to { | ||
opacity: 1; | ||
transform: translateY(0); | ||
} | ||
} | ||
|
||
@keyframes fadeIn { | ||
from { | ||
opacity: 0; | ||
} | ||
|
||
to { | ||
opacity: 1; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters