Canvas

基础矩形

	rect(x,y,width,height)

基础画法

        const res = main.getContext("2d");
        res.fillRect(0, 0, 300, 300); // 填满
        res.strokeRect(290, 290, 300, 300); // 线

组合画法

	const res = main.getContext("2d")
	res.beginPath()
	res.rect(0,0,300,300)
	res.fill()
	res.closePath()
	res.beginPath()
	res.rect(290, 290, 300, 300)
	res.stroke()
	res.closePath()

清除画法

	res.clearRect(0,0,res.clientWidth,res.clientHeight)

零碎

// 连续绘制
	res.beginPath()
	res.rect(290, 290, 300, 300)
	moveTo(x,y) ---> 移动不连续的点继续绘制
	res.stroke()
	res.closePath()
// 绘制直线
    res.lineTo(10,10)

相关推荐

  1. Canvas

    2024-07-16 08:50:05       24 阅读
  2. Canvas学习笔记

    2024-07-16 08:50:05       61 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-07-16 08:50:05       67 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-07-16 08:50:05       72 阅读
  3. 在Django里面运行非项目文件

    2024-07-16 08:50:05       58 阅读
  4. Python语言-面向对象

    2024-07-16 08:50:05       69 阅读

热门阅读

  1. 增加扫地机器人的智能化功能

    2024-07-16 08:50:05       24 阅读
  2. 网络爬虫Scrapy shell 的使用和介绍

    2024-07-16 08:50:05       26 阅读
  3. 卡码网语言基础课 | 10. 平均绩点

    2024-07-16 08:50:05       24 阅读
  4. RoCE-SAN和RoCE区别

    2024-07-16 08:50:05       21 阅读
  5. CSS基础

    2024-07-16 08:50:05       20 阅读
  6. C# 继承

    2024-07-16 08:50:05       26 阅读
  7. 设计模式-三大分类

    2024-07-16 08:50:05       18 阅读
  8. JVM常见面试题2

    2024-07-16 08:50:05       23 阅读
  9. GitHub热门开源项目-2024版

    2024-07-16 08:50:05       24 阅读
  10. 浅谈微服务

    2024-07-16 08:50:05       18 阅读