<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
canvas{
border: solid;
}
</style>
</head>
<body>
<canvas id="canvas" width="400" height="300"></canvas>
<script src="main.js"></script>
</body>
</html>
 (function () {

     var curX = -400, speed = 1;
var text = "Hello World";
var canvas = document.getElementById("canvas");
var con = canvas.getContext("2d"); function clearCanvas() {
con.clearRect(0, 0, 400, 300);
} function render() {
clearCanvas(); con.save();
con.font = "50px 宋体";
con.fillStyle = "#abcdef";
con.fillText(text, 80, 250);
con.restore(); con.save();
con.beginPath();
curX += speed;
con.rect(curX, 0, 400, 300);
con.closePath();
con.clip(); con.font = "50px 宋体";
con.fillStyle = "coral";
con.fillText(text, 80, 250);
con.restore();
// console.log("e");
requestAnimationFrame(render);
} function init() {
render();
} init();
})();

最新文章

  1. 微软要如何击败Salesforce?Office365、Azure、Dynamics365 全面布局AI | 双语
  2. 【Paddy】数据库监控系列(一) - 监控理念
  3. STL容器
  4. HDNOIP普及+提高整合
  5. Zigzag convert
  6. java中快速排序的理解以及实例
  7. 计算html标签textarea字符长度
  8. gomobile 真机 log 打出的日志跟踪
  9. QT5 串口收发实例代码
  10. JavaScript 高级程序设计 目录
  11. linux命令--virtualenv
  12. Servlet之会话(Session)以及会话追踪技术(Cookie),(URL重写)和(隐藏表单域)
  13. spring-boot-starter-actuator /info获取空信息
  14. vscode垂直选中列选中
  15. iOS10.3 起,将支持应用内评分
  16. MAC /usr/local 文件夹权限问题
  17. module.exports小程序模块化,require
  18. ​游戏设计思考:对COK的理解和思考
  19. mongo数据库命令简单学习
  20. 使用VS Code编译运行C/C++程序

热门文章

  1. SQl格式化日期时间
  2. jQuerySchool
  3. thinkphp的自动完成功能说明
  4. missing sdkl in .NET Core 1.0.1 - VS 2015 Tooling Preview 2
  5. 梯度下降法VS随机梯度下降法 (Python的实现)
  6. [CF738D]Sea Battle(贪心)
  7. [HDOJ5952]Counting Cliques(DFS,剪枝)
  8. 用Spring MVC开发简单的Web应用
  9. XAF应用开发教程(五)验证模块
  10. NYOJ 128 前缀式计算