网站首页 > 知识剖析 正文
<!DOCTYPE html>
<html>
<head>
<meta charset="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)
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>
- 上一篇: 网页滚动条样式设置CSS html网页滚动效果
- 下一篇: CSS 滚动驱动动画终于正式支持了~
猜你喜欢
- 2024-12-25 uni-app入门理论知识 uni-app入门到实战
- 2024-12-25 公开招标=轴承滚动体厂齿箱滚子生产线厂房东侧通道维修项目
- 2024-12-25 vue实现滑块拖拽校验 vue滑动条
- 2024-12-25 Vue中如何实现列表动画 vue 动画示例
- 2024-12-25 2022年最好的10个JavaScript动画库
- 2024-12-25 MacOS 如何选择鼠标不飘滚动平滑 mac鼠标滑轮上下滚动设置
- 2024-12-25 新版Chrome浏览器如何使用网页滚动截图
- 2024-12-25 10个滚动到底部自动加载插件 10个滚动到底部自动加载插件是什么
- 2024-12-25 前端特效 | 如何制作一个彩虹滚动进度条?
- 2024-12-25 滚动图标——手机图标随着手势滚动,让你的桌面动起来
- 最近发表
- 标签列表
-
- xml (46)
- css animation (57)
- array_slice (60)
- htmlspecialchars (54)
- position: absolute (54)
- datediff函数 (47)
- array_pop (49)
- jsmap (52)
- toggleclass (43)
- console.time (63)
- .sql (41)
- ahref (40)
- js json.parse (59)
- html复选框 (60)
- css 透明 (44)
- css 颜色 (47)
- php replace (41)
- css nth-child (48)
- min-height (40)
- xml schema (44)
- css 最后一个元素 (46)
- location.origin (44)
- table border (49)
- html tr (40)
- video controls (49)