draw () {

        let context = this.context;
        const {width,height} = this.props;

        // Clear the canvas
        context.clearRect(0, 0, width, height);

        // Draw the axes in their own path
        context.beginPath();
        context.stroke();

        // Set styles for animated graphics
        context.save();
        context.strokeStyle = '#0f0';
        context.fillStyle = '#fff';
        context.lineWidth = 2;

        // Draw the sine curve at time draw.t, as well as the circle.
        context.beginPath();
        this.status = (this.status + 20);
        if(this.status > width) {
            this.status = 0;
        }
        this.drawSine(0,this.status);

        context.stroke();

        // Restore original styles
        context.restore();

        setTimeout(()=>{this.draw();}, 55);
    }
/**
     * Draw animation function.
     *
     * This function draws one frame of the animation, waits 20ms, and then calls
     * itself again.
     */
Draw animation function.
This function draws one frame of the animation, waits 20ms, and then calls
itself again.
Draw animation function . This function draws one frame of the animation waits 20ms and then calls itself again .
draw () {
        let context = this.context;
        const {width,height} = this.props;
        context.clearRect(0, 0, width, height);
        context.beginPath();
        context.stroke();
        context.save();
        context.strokeStyle = '#0f0';
        context.fillStyle = '#fff';
        context.lineWidth = 2;
        context.beginPath();
        this.status = (this.status + 20);
        if(this.status > width) {
            this.status = 0;
        }
        this.drawSine(0,this.status);
        context.stroke();
        context.restore();
        setTimeout(()=>{this.draw();}, 55);
    }
draw ( ) { let context = this . context ; const { width , height } = this . props ; context . clearRect ( 0 , 0 , width , height ) ; context . beginPath ( ) ; context . stroke ( ) ; context . save ( ) ; context . strokeStyle = '#0f0' ; context . fillStyle = '#fff' ; context . lineWidth = 2 ; context . beginPath ( ) ; this . status = ( this . status + 20 ) ; if ( this . status > width ) { this . status = 0 ; } this . drawSine ( 0 , this . status ) ; context . stroke ( ) ; context . restore ( ) ; setTimeout ( ( ) => { this . draw ( ) ; } , 55 ) ; }
Draw animation function.
Draw animation function .
// Clear the canvas // Draw the axes in their own path // Set styles for animated graphics // Draw the sine curve at time draw.t, as well as the circle. // Restore original styles