【单选题】创建如下的渐变效果,补全代码处填入的正确代码是? context.fillStyle = gradient; context.fillRect(0, 0, canvas.width, canvas.height);
A.
gradient = context.createLinearGradient(0, 0, canvas.width, 0); gradient.addColorStop(0, "#fff"); gradient.addColorStop(1, "#f00");
B.
gradient = context.createLinearGradient(0, 0, 0, canvas.height); gradient.addColorStop(0, "#fff"); gradient.addColorStop(1, "#f00");
C.
gradient = context.createLinearGradient(0, 0, canvas.width, canvas.height); gradient.addColorStop(0, "#fff"); gradient.addColorStop(1, "#f00");
D.
gradient = context.createLinearGradient(0, 0, canvas.width, canvas.height); gradient.addColorStop(0, "white"); gradient.addColorStop(1, "red");