for example I want to distribute the numbers 1 to 10 in a circle and at the end I want to have a gap between the numbers 1 and 10, just like shown in the image here example, I have tried but for some reason only number 10 is showing up, I would really appreciate the help.
Thanks.
what i have tried:
window.onload = function() {
var num = 10;
var angle = (1.6 * Math.PI)/(num); var count = 0;
var rpmelement = document.getElementById("rpmelement");
var rpmnums = ["1","2","3","4","5","6","7","8","9","10"];
console.log(angle)
function RPM() {
this.angle = angle * count;
count++;
console.log(this.angle,count)
this.x = Math.cos(this.angle) * 90;
this.y = Math.sin(this.angle) * 90;
}
RPM.prototype.create = function() {
var rpm = document.createElement("div");
for (var i = 0; i < rpmnums.length; i++) {
rpm.style.top = this.y + -90 + "px";
rpm.style.left = this.x + 174 + "px";
rpm.className = "rpm";
rpm.innerHTML = rpmnums[i];
rpmelement.appendChild(rpm);
}
}
for (var i = 0; i < num; i++) {
var d = new RPM();
d.create();
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…