<!DOCTYPE html>

<html>

<head>

html动态字体html中滚动字体的设置 PHP
(图片来自网络侵删)

<meta charset=&#34;utf-8">

<title>滚动字体的设置</title>

</head>

<body>

<canvas id="canvas1" width="600" height="600" style="border:1px solid #000000"></canvas>

<script type="text/javascript">

var canvas1 = document.querySelector("#canvas1") // 1.找到画布工具

var ctx = canvas1.getContext("2d") // 2.高下文工具(画笔)

ctx.shadowBlur = 10; // 阴影间隔

ctx.shadowColor = "red" // 阴影颜色

ctx.shadowOffsetX = 30 // 阴影偏移

ctx.shadowOffsetY = 30 // 阴影偏移

ctx.font = "150px 楷体"

ctx.fillText("你好!
", 20,150)

ctx.fillText("你好!
", 20,350)

ctx.strokeText('你好!
',23, 153)

ctx.strokeText('你好',23, 553)

canvas绘制笔墨

var x = 600

setInterval(function(){

if(x > -350){

//清空画布

ctx.clearRect(0,0,600,600)

ctx.strokeText('你好!
',x, 153)

ctx.fillText("你好!
", x,350)

ctx.font = "50px 宋体"

ctx.strokeText('每天学习一点点',x, 553)

x -= 3

}else{x=590}

}, 16)

</script>

</body>

</html>