Answer the question
In order to leave comments, you need to log in
How to make this effect on canvas?
Good afternoon.
Interested in how you can make a circle of numbers like in the picture?
Answer the question
In order to leave comments, you need to log in
Just circles: jsFiddle
var canvas = document.getElementById("myCanvas")
, ctx = canvas.getContext("2d")
, r
;
ctx.translate( 500/2, 500/2); // передвинуться на центр листа
ctx.font = "14px Arial";
ctx.textAlign = "center";
ctx.textBaseline="middle";
ctx.fillStyle = "#999";
for(r=100;r<=500;r+=20) circle(r);
function circle(r) {
var dist = 16
, n = Math.round( 2 * Math.PI * r / dist)
, i
;
for(i=0;i<n;i++) {
ctx.rotate( 2 * Math.PI / n); // повернуть лист
ctx.fillText( Math.round(100*Math.random())%2?0:1,0,-r);
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question