24 lines
497 B
JavaScript
24 lines
497 B
JavaScript
const canvas = document.getElementById('my-canvas');
|
|
const ctx = canvas.getContext('2d');
|
|
canvas.width = window.innerWidth;
|
|
canvas.height = window.innerHeight;
|
|
// console.log(ctx);
|
|
|
|
ctx.beginPath();
|
|
|
|
|
|
// canvas.addEventListener('mousemove', function (e){
|
|
// console.log(e.x, e.y);
|
|
// ctx.rect(e.x,e.y,10,10);
|
|
// ctx.fill( );
|
|
// // ctx.stroke();
|
|
|
|
// });
|
|
|
|
const degreeToRad = (deg) =>{
|
|
return deg / 180 * Math.PI;
|
|
}
|
|
|
|
ctx.arc(100, 100, 50, 0, degreeToRad(360));
|
|
ctx.stroke();
|