Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added volume slider #2

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ This section details the series of instructions provided to ChatGPT for the crea

### Add Alarm Sound
- "Now I want it to play a sound when it finishes."
- "How can i change the volume of the sound?"
- "Can you change the code so it shows only a volume knob?"
- "Can you change the code to display some text above the volume knob?"
- "Change the code so the volume slide is displayed in the lower right corner?"

### I Downloaded an Alarm Sound from the Internet
### But I Want to Make Sound Alarm Shorter with FFmpeg
Expand Down Expand Up @@ -51,4 +55,4 @@ This section details the series of instructions provided to ChatGPT for the crea

### Improve README.md
- "Make this README more informal, fun, and enjoyable, with emojis and so on..."
- "Not so informal, something in between, please."
- "Not so informal, something in between, please."
4 changes: 4 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@
src="https://cdn.glitch.global/a4d114d0-86a7-4f80-ba12-95f3b0ba963b/alarm.wav?v=1699704359595"
type="audio/wav"
></audio>
<div class="volume-container">
<label for="volumeSlider">Volume:</label>
<input type="range" min="0" max="1" step="0.01" value="1" id="volumeSlider">
</div>
<script src="script.js"></script>
</body>
</html>
5 changes: 5 additions & 0 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,13 @@ function updateSector() {
const radius = 9.2;
const knob = document.getElementById("knob");
const alarm = document.getElementById("alarm");
let volumeSlider = document.getElementById("volumeSlider");
let startTime = Date.now() - (TOTAL_DURATION_MS - remainingTimeMS);
let isMouseDown = false;

volumeSlider.addEventListener("input", function() {
alarm.volume = volumeSlider.value; // Set volume based on slider value
});

const calculateAngle = (clickX, clickY) => {
let angle = Math.atan2(clickY, clickX) + Math.PI / 2;
Expand Down
15 changes: 15 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,18 @@ html {
#sector {
fill: var(--sector-fill-color); /* Use CSS variable for color */
}
.volume-container {
position: fixed;
bottom: 20px;
right: 50px;
width: 150px; /* Adjust width as needed */
}

input[type="range"] {
width: 100%;
}

label {
display: block;
margin-bottom: 5px;
}