@@ -74,7 +74,7 @@ <h1>Winwheel.js example wheel - basic image wheel</h1>
7474 </ div >
7575 < script >
7676 // Create new wheel object specifying the parameters at creation time.
77- var theWheel = new Winwheel ( {
77+ let theWheel = new Winwheel ( {
7878 'numSegments' : 4 , // Specify number of segments.
7979 'outerRadius' : 150 , // Set outer radius so wheel fits inside the background.
8080 'drawMode' : 'image' , // drawMode must be set to image.
@@ -105,7 +105,7 @@ <h1>Winwheel.js example wheel - basic image wheel</h1>
105105 } ) ;
106106
107107 // Create new image object in memory.
108- var loadedImg = new Image ( ) ;
108+ let loadedImg = new Image ( ) ;
109109
110110 // Create callback to execute once the image has finished loading.
111111 loadedImg . onload = function ( )
@@ -120,35 +120,31 @@ <h1>Winwheel.js example wheel - basic image wheel</h1>
120120
121121
122122 // Vars used by the code in this page to do power controls.
123- var wheelPower = 0 ;
124- var wheelSpinning = false ;
123+ let wheelPower = 0 ;
124+ let wheelSpinning = false ;
125125
126126 // -------------------------------------------------------
127127 // Function to handle the onClick on the power buttons.
128128 // -------------------------------------------------------
129129 function powerSelected ( powerLevel )
130130 {
131131 // Ensure that power can't be changed while wheel is spinning.
132- if ( wheelSpinning == false )
133- {
132+ if ( wheelSpinning == false ) {
134133 // Reset all to grey incase this is not the first time the user has selected the power.
135134 document . getElementById ( 'pw1' ) . className = "" ;
136135 document . getElementById ( 'pw2' ) . className = "" ;
137136 document . getElementById ( 'pw3' ) . className = "" ;
138137
139138 // Now light up all cells below-and-including the one selected by changing the class.
140- if ( powerLevel >= 1 )
141- {
139+ if ( powerLevel >= 1 ) {
142140 document . getElementById ( 'pw1' ) . className = "pw1" ;
143141 }
144142
145- if ( powerLevel >= 2 )
146- {
143+ if ( powerLevel >= 2 ) {
147144 document . getElementById ( 'pw2' ) . className = "pw2" ;
148145 }
149146
150- if ( powerLevel >= 3 )
151- {
147+ if ( powerLevel >= 3 ) {
152148 document . getElementById ( 'pw3' ) . className = "pw3" ;
153149 }
154150
@@ -167,20 +163,14 @@ <h1>Winwheel.js example wheel - basic image wheel</h1>
167163 function startSpin ( )
168164 {
169165 // Ensure that spinning can't be clicked again while already running.
170- if ( wheelSpinning == false )
171- {
166+ if ( wheelSpinning == false ) {
172167 // Based on the power level selected adjust the number of spins for the wheel, the more times is has
173168 // to rotate with the duration of the animation the quicker the wheel spins.
174- if ( wheelPower == 1 )
175- {
169+ if ( wheelPower == 1 ) {
176170 theWheel . animation . spins = 2 ;
177- }
178- else if ( wheelPower == 2 )
179- {
171+ } else if ( wheelPower == 2 ) {
180172 theWheel . animation . spins = 5 ;
181- }
182- else if ( wheelPower == 3 )
183- {
173+ } else if ( wheelPower == 3 ) {
184174 theWheel . animation . spins = 8 ;
185175 }
186176
0 commit comments