const canvas = document.getElementById('myCanvas');
const context = canvas.getContext('2d');
const centerX = canvas.width / 2;
const centerY = canvas.height / 2;
let radius = 60;
context.beginPath();
context.fillStyle = '#0077aa';
context.strokeStyle = '#0077aa47';
context.lineWidth = 2;
context.arc(centerX, centerY, radius, 0, 2 * Math.PI, false);
context.fill();
context.stroke();
<select name="cars" id="cars">
<option value="circularly">CIRCULARLY</option>
<option value="horizontally">HORIZONTALLY</option>
<option value="vertically">VERTICALLY</option>
<option value="random">AT RANDOM POSITION</option>
</select>
<canvas id="myCanvas" ></canvas>
JS
How to animate the circle in different ways? circularly, horizontally, vertically, at random position How to do that ?
const canvas = document.getElementById('myCanvas');
const context = canvas.getContext('2d');
const centerX = canvas.width / 2;
const centerY = canvas.height / 2;
let radius = 60;
context.beginPath();
context.fillStyle = '#0077aa';
context.strokeStyle = '#0077aa47';
context.lineWidth = 2;
context.arc(centerX, centerY, radius, 0, 2 * Math.PI, false);
context.fill();
context.stroke();
HTML
How to animate the circle in different ways? circularly, horizontally, vertically, at random position How to do that ?
<select name="cars" id="cars">
<option value="circularly">CIRCULARLY</option>
<option value="horizontally">HORIZONTALLY</option>
<option value="vertically">VERTICALLY</option>
<option value="random">AT RANDOM POSITION</option>
</select>
<canvas id="myCanvas" ></canvas>