15 Star 142 Fork 45

德育处主任 / Fabric.js学习资料(中文教程)

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
BaseBrush.html 1.23 KB
一键复制 编辑 原始数据 按行查看 历史
德育处主任 提交于 2022-08-15 12:19 . 全局更新fabric版本
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>基础笔刷 BaseBrush</title>
</head>
<body>
<canvas id="c" width="600" height="400" style="border: 1px solid #ccc;"></canvas>
<script src="../../script/fabric.js"></script>
<script>
const canvas = new fabric.Canvas('c')
canvas.freeDrawingBrush.width = 20 // 画笔宽度
canvas.freeDrawingBrush.color = 'pink' // 画笔颜色
canvas.freeDrawingBrush.limitedToCanvasSize = true // 能否超出当前画板
canvas.freeDrawingBrush.strokeDashArray = [20, 50] // 行程破折号数组
// 画笔投影
canvas.freeDrawingBrush.shadow = new fabric.Shadow({
blur: 10,
offsetX: 10,
offsetY: 10,
affectStroke: true,
color: '#30e3ca'
})
canvas.freeDrawingBrush.strokeLineCap = 'round' // 线条结尾的画笔风格 butt | round | square , default round
canvas.freeDrawingBrush.strokeLineJoin = 'miter' // 画笔的角落风格 bevel | round | miter
canvas.freeDrawingBrush.strokeMiterLimit = 100 // 最大斜接长度
canvas.isDrawingMode = true
</script>
</body>
</html>
JavaScript
1
https://gitee.com/k21vin/fabricjs-demo.git
git@gitee.com:k21vin/fabricjs-demo.git
k21vin
fabricjs-demo
Fabric.js学习资料(中文教程)
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891