04 - Ball Acceleration/script.js
//displaying the current acceleration and the velocity of the ball

displaying the current acceleration and the velocity of the ball
displaying the current acceleration and the velocity of the ball
display(){
        ctx.beginPath();
        ctx.moveTo(this.x, this.y);
        ctx.lineTo(this.x + this.acc_x*100, this.y + this.acc_y*100);
        ctx.strokeStyle = "green";
        ctx.stroke();
        ctx.closePath();
        ctx.beginPath();
        ctx.moveTo(this.x, this.y);
        ctx.lineTo(this.x + this.vel_x*10, this.y + this.vel_y*10);
        ctx.strokeStyle = "blue";
        ctx.stroke();
        ctx.closePath();
    }
display ( ) { ctx . beginPath ( ) ; ctx . moveTo ( this . x , this . y ) ; ctx . lineTo ( this . x + this . acc_x * 100 , this . y + this . acc_y * 100 ) ; ctx . strokeStyle = "green" ; ctx . stroke ( ) ; ctx . closePath ( ) ; ctx . beginPath ( ) ; ctx . moveTo ( this . x , this . y ) ; ctx . lineTo ( this . x + this . vel_x * 10 , this . y + this . vel_y * 10 ) ; ctx . strokeStyle = "blue" ; ctx . stroke ( ) ; ctx . closePath ( ) ; }
displaying the current acceleration and the velocity of the ball
displaying the current acceleration and the velocity of the ball