DmitrMakeev
commited on
Commit
•
93ac4fe
1
Parent(s):
ef1d0b7
Update koleso.html
Browse files- koleso.html +6 -3
koleso.html
CHANGED
@@ -99,7 +99,6 @@ const arc = TAU / sectors.length
|
|
99 |
const friction = 0.991 // 0.995=soft, 0.99=mid, 0.98=hard
|
100 |
let angVel = 0 // Angular velocity
|
101 |
let ang = 0 // Angle in radians
|
102 |
-
let hasSpun = localStorage.getItem('hasSpun') === 'true'
|
103 |
|
104 |
const getIndex = () => Math.floor(tot - (ang / TAU) * tot) % tot
|
105 |
|
@@ -151,12 +150,16 @@ function engine() {
|
|
151 |
}
|
152 |
|
153 |
function init() {
|
|
|
|
|
|
|
|
|
154 |
sectors.forEach(drawSector)
|
155 |
rotate() // Initial rotation
|
156 |
engine() // Start engine
|
157 |
spinEl.addEventListener('click', () => {
|
158 |
-
if (
|
159 |
-
hasSpun
|
160 |
angVel = rand(0.25, 0.45)
|
161 |
spinWheel()
|
162 |
} else {
|
|
|
99 |
const friction = 0.991 // 0.995=soft, 0.99=mid, 0.98=hard
|
100 |
let angVel = 0 // Angular velocity
|
101 |
let ang = 0 // Angle in radians
|
|
|
102 |
|
103 |
const getIndex = () => Math.floor(tot - (ang / TAU) * tot) % tot
|
104 |
|
|
|
150 |
}
|
151 |
|
152 |
function init() {
|
153 |
+
if (!localStorage.getItem('hasSpun')) {
|
154 |
+
localStorage.setItem('hasSpun', 'false')
|
155 |
+
}
|
156 |
+
|
157 |
sectors.forEach(drawSector)
|
158 |
rotate() // Initial rotation
|
159 |
engine() // Start engine
|
160 |
spinEl.addEventListener('click', () => {
|
161 |
+
if (localStorage.getItem('hasSpun') === 'false') {
|
162 |
+
localStorage.setItem('hasSpun', 'true')
|
163 |
angVel = rand(0.25, 0.45)
|
164 |
spinWheel()
|
165 |
} else {
|