I built a dashboard for my first baby with the ability to add milestones. I decided to use (⭐️) to represent each milestone achieved on a day and represent it as score. As you can see today, I added First smile, his score is (⭐️ x 1). To make it fun, on the desktop view, I would like to display the bouncing star. If his score is 3, 3 stars will be bouncing on the desktop.

Example

I've tried this
https://jsfiddle.net/bheng/cnxt9Lju/2/
<canvas id="myCanvas" width="400" height="200"></canvas>
var canvas = document.getElementById( "myCanvas" );
var context = canvas.getContext( "2d" );
var width = 400;
var height = 200;
var ball = {
x: 100,
y: 100,
radius: 25,
xSpeed: 3,
ySpeed: 3,
draw: function( ctx ) {
ctx.beginPath();
ctx.arc( this.x, this.y, this.radius, 0, 2*Math.PI );
ctx.fill();
},
move: function() {
this.x += this.xSpeed;
this.y += this.ySpeed;
}
}
setInterval( function(){
context.clearRect( 0, 0, width, height );
context.strokeRect( 0, 0, width, height );
ball.move();
// right
if ( ball.x + ball.radius >= width ) {
ball.x = width - ball.radius;
ball.xSpeed = -ball.xSpeed;
}
// left
if ( ball.x - ball.radius <= 0 ) {
ball.x = ball.radius;
ball.xSpeed = -ball.xSpeed;
}
// down
if ( ball.y + ball.radius >= height ) {
ball.y = height - ball.radius;
ball.ySpeed = -ball.ySpeed;
}
// up
if ( ball.y - ball.radius <= 0 ) {
ball.y = ball.radius;
ball.ySpeed = -ball.ySpeed;
}
ball.draw( context );
}, 10 );
but I'm not sure how to change the ball to ⭐️.
Also when I tried to modify the width and height to window.width, and window.height, it seem to break things.