我在 html5canvastutorials.com 上找到了本教程:
var triangle = new Kinetic.Shape(function(){
var context = this.getContext();
context.beginPath();
context.lineWidth = 4;
context.strokeStyle = "black";
context.fillStyle = "#00D2FF";
context.moveTo(120, 50);
context.lineTo(250, 80);
context.lineTo(150, 170);
context.closePath();
context.fill();
context.stroke();
});
triangle.addEventListener("mousemove", function(){
var mousePos = stage.getMousePos();
tooltip.x = mousePos.x;
tooltip.y = mousePos.y;
tooltip.text = "Cyan Triangle";
tooltip.draw();
});
该tooltip
对象在没有预先定义的情况下被使用。HTML 5 画布是否有预定义的tooltip
对象?或者我在这里错过了什么?