gpt-4-0314· OpenAI
WildChat-4.8M (AI2)
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"/> </head> <title>sequencer</title>…
- User
- Assistant
html, body { font-size: 16px; font-family: "Arial", sans-serif; box-sizing: border-box; }
a {
color: #007BFF;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
h1, h2, h3, h4, h5, h6 {
font-weight: bold;
margin-top: 0;
}
pre {
background-color: #f8f9fa;
padding: 8px;
overflow-x: auto;
}
.container {
max-width: 1200px;
margin: 0 auto;
padding: 30px 15px;
}
.sequencer {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
grid-gap: 20px;
margin-bottom: 20px;
}
.sequencer div {
padding: 20px;
text-align: center;
border: 1px solid #dee2e6;
border-radius: 4px;
cursor: pointer;
}
.sequencer div span {
display: block;
}
.sequencer div.active {
background-color: #007BFF;
color: #ffffff;
border-color: #007BFF;
}
.sequencer div.indicator {
background-color: #007BFF;
color: #ffffff;
border-color: #007BFF;
display: none;
}
.sequencer div.active.indicator {
display: block;
}
.controls {
display: flex;
align-items: center;
margin-bottom: 20px;
}
.controls button {
display: inline-block;
background-color: #007BFF;
color: #ffffff;
text-align: center;
border: none;
padding: 8px 16px;
cursor: pointer;
border-radius: 4px;
font-size: 16px;
margin-right: 10px;
}
.controls button:hover {
background-color: #0056b3;
}
.controls button[disabled] {
background-color: #6c757d;
cursor: default;
}
let intervalId = null;
let currentIndex = 0;
function play() {
intervalId = setInterval(() => {
sequencerDivs[currentIndex].classList.add("active");
setTimeout(() => {
sequencerDivs[currentIndex].classList.remove("active");
}, 250);
currentIndex = (currentIndex + 1) % sequencerDivs.length;
}, 500);
}
function stop() {
clearInterval(intervalId);
intervalId = null;
currentIndex = 0;
sequencerDivs.forEach((div) => {
div.classList.remove("active");
});
}
function togglePlayPause() {
if (intervalId === null) {
play();
playPauseButton.textContent = "Pause";
stopButton.disabled = false;
} else {
clearInterval(intervalId);
intervalId = null;
playPauseButton.textContent = "Play";
}
}
playPauseButton.addEventListener("click", togglePlayPause);
stopButton.addEventListener("click", stop);