我正在尝试在单击事件上旋转文本。它已经实现,但在谷歌浏览器中旋转时文本闪烁。它在 Mozilla 中运行良好。如何停止这种闪烁的文本。我不想减慢旋转速度并希望以相同的速度旋转,所以我不想改变过渡的持续时间。请帮忙。代码是
<html>
<head>
<style>
body { margin: 0px; padding: 0px; }
canvas { border: 1px solid #9C9898; }
</style>
<script src="http://www.html5canvastutorials.com/libraries/kinetic-v3.10.2.js"></script>
<script>
window.onload = function()
{
var angle = 0;
var stage = new Kinetic.Stage(
{
container: "container",
width: 578,
height: 200
});
var layer = new Kinetic.Layer();
var text = new Kinetic.Text(
{
x:225,
y: 80,
text: "Simple",
fontSize: 12,
fontFamily: "Calibri",
textFill: "black"
});
text.on("click", function()
{
angle+=1
text.transitionTo(
{
rotation:Math.PI*angle/2,
duration:1
});
});
layer.add(text);
stage.add(layer);
}
</script>
</head>
<body>
<div id="container"></div>
</body>
</html>