DmitrMakeev commited on
Commit
06f0aeb
1 Parent(s): 94a5fb4

Update koleso.html

Browse files
Files changed (1) hide show
  1. koleso.html +8 -8
koleso.html CHANGED
@@ -78,13 +78,13 @@ body {
78
  <script>
79
 
80
  const sectors = [
81
- { color: '#f82', label: 'Stack', probability: 1 },
82
  { color: '#0bf', label: '10', probability: 20 },
83
- { color: '#fb0', label: '200', probability: 16 },
84
- { color: '#0fb', label: '50', probability: 26 },
85
- { color: '#b0f', label: '100', probability: 16 },
86
- { color: '#f0b', label: '5', probability: 16 },
87
- { color: '#bf0', label: '500', probability: 15 }
88
  ]
89
 
90
  const rand = (m, M) => Math.random() * (M - m) + m
@@ -99,7 +99,7 @@ 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
 
@@ -137,7 +137,7 @@ function frame() {
137
  if (angVel < 0.002) {
138
  angVel = 0 // Bring to stop
139
  const sector = sectors[getIndex()]
140
- localStorage.setItem('hasSpun', 'true')
141
  console.log('Result:', sector.label)
142
  }
143
  ang += angVel // Update angle
 
78
  <script>
79
 
80
  const sectors = [
81
+ { color: '#f82', label: 'Stack', probability: 10 },
82
  { color: '#0bf', label: '10', probability: 20 },
83
+ { color: '#fb0', label: '200', probability: 15 },
84
+ { color: '#0fb', label: '50', probability: 20 },
85
+ { color: '#b0f', label: '100', probability: 15 },
86
+ { color: '#f0b', label: '5', probability: 10 },
87
+ { color: '#bf0', label: '500', probability: 10 }
88
  ]
89
 
90
  const rand = (m, M) => Math.random() * (M - m) + m
 
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 = false
103
 
104
  const getIndex = () => Math.floor(tot - (ang / TAU) * tot) % tot
105
 
 
137
  if (angVel < 0.002) {
138
  angVel = 0 // Bring to stop
139
  const sector = sectors[getIndex()]
140
+ hasSpun = true
141
  console.log('Result:', sector.label)
142
  }
143
  ang += angVel // Update angle