DmitrMakeev commited on
Commit
943b892
1 Parent(s): b94e502

Update koleso.html

Browse files
Files changed (1) hide show
  1. koleso.html +3 -3
koleso.html CHANGED
@@ -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 = false
103
 
104
  const getIndex = () => Math.floor(tot - (ang / TAU) * tot) % tot
105
 
@@ -118,7 +118,7 @@ function drawSector(sector, i) {
118
  ctx.rotate(ang + arc / 2)
119
  ctx.textAlign = 'right'
120
  ctx.fillStyle = '#fff'
121
- ctx.font = 'bold 39px sans-serif' // Увеличенный размер шрифта на 30%
122
  ctx.fillText(sector.label, rad - 10, 10)
123
  //
124
  ctx.restore()
@@ -137,7 +137,7 @@ function frame() {
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
 
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
 
 
118
  ctx.rotate(ang + arc / 2)
119
  ctx.textAlign = 'right'
120
  ctx.fillStyle = '#fff'
121
+ ctx.font = 'bold 21px sans-serif' // Уменьшенный размер шрифта на 30%
122
  ctx.fillText(sector.label, rad - 10, 10)
123
  //
124
  ctx.restore()
 
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