如何在画布中用不透明度绘制文字



我需要帮助绘制我的天气应用文本。我需要在不透明度上显示的温度,以使外观很好,

我该如何在画布中做到这一点?

请帮忙!预先感谢!

您必须与之一起玩,但类似:

<html>
<body>
<canvas id="myCanvas" width="300" height="150" style="border:1px solid #d3d3d3;">
Your browser does not support the HTML5 canvas tag.</canvas>
<script>
var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
// code to draw picture as normal
ctx.globalAlpha = 0.5;
// code to draw text
</script>
</body>
</html>

最新更新