【发布时间】:2011-01-31 09:32:59
【问题描述】:
我尝试使用这个简单的功能: http://code.google.com/p/canvasimagegradient/ 我必须用画布和 js 创建一个线性透明渐变(我的图像必须是动态的)但我的代码它不起作用.. 你能告诉我哪里错了吗?
var ctx = $('#thecanvas')[0].getContext("2d");
var theImage= $('#theimage');
var linearGradient = ctx.createLinearGradient(0, 0, 0, theImage.height);
linearGradient.addColorStop(0, "transparent");
linearGradient.addColorStop(1, "#000");
ctx.drawImageGradient(theImage, 12, 65, linearGradient);
调试器只是告诉我: 控制台说我:
NOT_SUPPORTED_ERR: DOM Exception 9: The implementation did not support
就在这一行下面:
var linearGradient = ctx.createLinearGradient(0, 0, 0, theImage.height);
提前非常感谢:)
【问题讨论】:
标签: javascript image image-processing canvas gradient