i have a spinning logo, and i want to make a button that changes the speed. I want it to be able to be decreased infinitely smaller, or bigger. What i don't understand is how to edit the speed. This would be greatly appreciated. Im just writing text till it let me post now
main.js
import React from 'react';
import logo from './image.png';
import './App.css';
function App() {
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo-circle" alt="White cross, with a blue bacground spining" id='spinnerLogo'/>
<p>Hello, and welcome to the begining of the Swiss Plus Website. <strong>We hope you enjoy your stay</strong></p>
<button className='App-button' id='fastLogoButton'>Increase Spin Speed!</button>
<button className='App-button' id='slowLogoButton'>Decrease Spin Speed!</button>
</header>
</div>
);
}
var logo = document.getElementById("spinnerLogo"),
fasterLogo = document.getElementById('fastLogoButton');
slowerLogo = document.getElementById('slowLogoButton')
function faster () {
var button = this;
logo.style.animation = App-logo-spin infinite 5s linear;
}
fasterLogo.onclick = faster
export default App;
main.css
.App {
text-align: center;
}
.App-logo {
height: 40vmin;
pointer-events: none;
}
@media (prefers-reduced-motion: no-preference) {
.App-logo-circle {
border-radius: 50%;
animation: App-logo-spin infinite 5s linear;
}
}
.App-button {
padding: .5em 2em;
border-radius: 6px;
background-color: skyblue;
border: none;
}
.App-header {
background-color: #282c34;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: calc(10px + 2vmin);
color: white;
}
.App-link {
color: #61dafb;
}
@keyframes App-logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}