function spinWheel(index) {
// Reset animation
document.querySelector('#cevir').disabled = true;
document.querySelector('#cevir').style.backgroundColor = 'grey';
document.querySelector('#cevir').innerHTML = 'Çevriliyor...';
wheelEl.style.transition = "none";
wheelEl.style.transform = "rotate(0deg)";
// Play animation on the next frame
setTimeout(() => {
wheelEl.style.transition = "all ease-out 5s";
// Target rotation margin
const rotMin = (sliceSize * (index)) + (sliceSize / 20);
const rotMax = (sliceSize * (index)) - (sliceSize / 20);
// Target rotation
const fullRots = Math.floor(Math.random() * 5) + 5; // minimum 5 rotations max 9
const rot = (fullRots * 360) + Math.floor(Math.random() * (rotMax - rotMin + 1) + rotMin);
wheelEl.style.transform = `rotate(-${rot}deg)`;
}, 0);
} javascript settimeout sonrasında işlem
1
●72
- 07-12-2022, 23:24:00merhaba, settimeout ile çark sistemi döndürüyorum fakat bittiğinde alert verdirmek istiyorum, settimeout sonrasında nasıl işleme gireceğimi bilemedim.
- 13-12-2022, 23:48:48Kodu bir kere çağıracaksanız neden bir daha setTimeout içine aldınız?