I'm trying to make a animation where a object moving, but I can't find a way to make the object look like it is moving
The object I want to is labeled //object in the code
If anyone could help me it would be very helpful
im not sure
i have used
const canvas = document.getElementById('canvas');
const ctx = canvas.getContext('2d');
ctx.clearRect(0, 0, canvas.width, canvas.height);
and then make a new ctx with the updates coordinates. Im a little confused on what you want to do.
ctx.ellipse(x, y, radius1, radius2, direction, startAngle, endAngle);
very similar to ctx.arc() except with two radii and a rotation
@dnilem26 clearRect clears the entire specified rectangle, which if you use 0, 0, canvas.width, canvas.height will clear the entire canvas. If you absolutely can't clear the entire canvas for whatever reason you can clear the ellipse itself by setting the stroke and/or fill to the background color and drawing it in the same position, though it's not recommended and it can't handle overlaps.