我正在尝试使用以下脚本在圆圈内添加图像:
....
var rCvisible = false;
...
var rC = new Image();
rCircle;
rC.onload = function () {
rCircle = new Kinetic.Image({
image: rC,
opacity: 0.3,
visible: rCvisible
});
};
rC.src = '../../Content/images/rotate.png';
var circle2 = new Kinetic.Circle({
drawFunc: function (canvas) {
var context2 = canvas.getContext();
centerX2 = blueLine2.getPosition().x;
centerY2 = greenLine2.getPosition().y;
context2.drawImage(rC, centerX2 - 20, centerY2 - 20, 44, 40);
context2.beginPath();
context2.arc(centerX2, centerY2, this.getRadius(), 0, 2 * Math.PI, false);
context2.lineWidth = this.getStrokeWidth();
context2.strokeStyle = this.getStroke();
context2.stroke();
},
x: cx + gx,
y: cy + gy,
radius: 70,
stroke: '#00ffff',
strokeWidth: 3,
opacity: 0.5
});
.....
circle2.on('mouseover', function () {
document.body.style.cursor = 'pointer';
rCvisible = true;
layer2.draw();
});
circle2.on('mouseout', function () {
document.body.style.cursor = 'default';
rCvisible = false;
layer2.draw();
});
我也试过:
context2.drawImage(rC, centerX2 - 20, centerY2 - 20, 44, 40, setVisible(false));
我的目标是隐藏图像,然后在鼠标在圆圈内时显示它。我收到以下错误:
'setVisible' is undefined
非常感谢您的建议,在此先感谢。