你可能想用jQuery來試試它。
<html>
<head>
<!-- Path to your jQuery core js library or you can use one from Google.
<script type="text/javascript" src="jquery.min.js" />
<!-- Path to your jQuery UI js library or you can use one from Google.
<script type="text/javascript" src="jquery-ui.min.js" />
</head>
<body>
<canvas id="myCanvas" ..>..</canvas>
</body>
</html>
而當你想淡出出來,只要致電:
$("#myCanvas").fadeOut(2500); // 2 seconds and a half, for example
還有其他的「效果」,如:
$("#myCanvas").slideUp(1500); // 1 and a half seconds, for example
我想淡化這個圓圈,而不是所有的畫布。 –
@Jack看到我更新的小提琴 – Andrew
這很好。這就是我想要做的第一件事,但如果用戶離開畫布,他們是一個快速眨眼= /這就是爲什麼我想嘗試淡入淡出效果。 –