Animating stroke on canvas with TweenMax.js

An example of animating stroke on canvas with TweenMax.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<!DOCTYPE html>
<html>
<head>
    <script src="js/TweenMax.min.js"></script>
</head>
<body>
    
<canvas id="myCanvas" width="500" height="500"></canvas>
<script>
    
var context, canvas, myRectangle;
    
    canvas = document.getElementById('myCanvas');
    context = canvas.getContext('2d');
  function drawRectangle(myRectanglecontext) {
      
        context.beginPath();
        context.rect(myRectangle.x, myRectangle.y, myRectangle.width, myRectangle.height);
        context.fillStyle = 'green';
        context.fill();
        context.lineWidth = myRectangle.borderWidth;
        context.strokeStyle = 'black';
        context.stroke();
      
  }
  
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX