# How to divide count by 8 points instead of 10?

Currently implemented count 10 points of the wheel, and how to make it 8?

https://codepen.io/infernotiv/pen/xpjBOz
June 7th 19 at 14:58
June 7th 19 at 15:00
1) Replace the picture on the one with 8 points
2) In line 22 instead of 11 try to put 9 . But hell knows.
did not work
https://codepen.io/anon/pen/aqXgdN - Kyra_Lehner commented on June 7th 19 at 15:03
June 7th 19 at 15:02
in General here such as:
1) Replace the picture on the one with 8 points
2)
``console.log("numSect:" + parseInt(((rot % 360 - 18) / 36 - 8)) * -1);``
replace with 8
3) after the line
``````var rand = Math.random() * (90 - 30) + 30;
var rot = curDeg + rand * 360;``````

to insert a cycle
``````if (rot>70000) {
while (rot > 70000) {
var rot = curDeg + rand * 360;
}
}``````

the complete code
``````var curDeg = 0;
\$('.reset-btn').click(function(){
\$('.roulette').animate(
{rotation: 0},
{
duration: 2000,
step: function(now, fx) {
\$(this).css({"transform": "translate(-50%, -50%) rotate("+now+"deg)"});
curDeg = 0;
}
}
);
});

\$('.roll-btn').click(function(){
// var rand = (Math.random() * 4) * (Math.random() * 6);
var rand = Math.random() * (90 - 30) + 30;
var rot = curDeg + rand * 360;

if (rot>70000) {
while (rot > 70000) {
var rot = curDeg + rand * 360;
}
}

console.log("rot:" + rot);
console.log("rand:" + rand);
console.log("curDeg:" + curDeg);
console.log("%: "+ rot % 360);
console.log("numSect:" + parseInt(((rot % 360 - 18) / 36 - 8)) * -1);
\$('.roulette').animate(
{rotation: rot},
{
duration: 2000,
step: function(now, fx) {
\$(this).css({"transform": "translate(-50%, -50%) rotate("+now+"deg)"});
curDeg = rot;
}
}
);
});``````

https://codepen.io/infernotiv/pen/xpjBOz?editors=0000

Find more questions by tags JavaScriptHTMLjQuery