这个 canvas 函数输入是如何从未定义递增的?

How this canvas function input is incrementing from undefined?

我在 Code Pen 上发现了这个 canvas 旋转。输入变量 step 没有收到任何值,但是一旦 requestAnimationFrame 开始 运行,step 就离开未定义状态并修改 angle 应该是NaN,这是怎么回事? Canvas Rotation - Code Pen

var canvas = document.getElementById('canvas');

var canvasWidth = canvas.width; 
var canvasHeight = canvas.height; 
var cx = canvasWidth/2;
var cy = canvasHeight/2;
var context = canvas.getContext("2d");

function draw(step){
  requestAnimationFrame(draw);
  
  context.fillStyle = "deepskyblue";
  context.fillRect(0,0, canvasWidth, canvasHeight);
  
  context.save();
   
  context.translate(cx, cy);
  var angle = step * 0.001; //HOW STEP GOT VALUE?
  context.rotate(angle);
  context.fillStyle = "tomato";
  context.fillRect(-50, -50, 100, 100);
  
  context.restore();
  
}

 requestAnimationFrame(draw);
<canvas width="320" height="240" id="canvas"></canvas>

将参数传递给给定回调的 requestAnimationFrame 方法:

来自documentation

The callback method is passed a single argument, a DOMHighResTimeStamp, which indicates the current time when callbacks queued by requestAnimationFrame() begin to fire. [...]

在这种情况下,它将分配给 step