You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
479 B
24 lines
479 B
|
|
<canvas id="canvas" style="border:1px solid #000"></canvas>
|
|
|
|
<script>
|
|
var canvas = document.getElementById('canvas');
|
|
var ctx = canvas.getContext('2d');
|
|
width=200;
|
|
height=200;
|
|
canvas.width=width;
|
|
canvas.height=height;
|
|
|
|
function faireCercle(x,y,color){
|
|
var cercle = new Path2D();
|
|
cercle.moveTo(x, y);
|
|
cercle.arc(x+25, y-25, 25, 0, 2 * Math.PI);
|
|
|
|
ctx.fillStyle = color;
|
|
ctx.fill(cercle);
|
|
}
|
|
|
|
faireCercle(50,50,"green");
|
|
faireCercle(50,100,"red");
|
|
|
|
</script> |