15 Star 168 Fork 59

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

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
PatternBrush.html 821 Bytes
一键复制 编辑 原始数据 按行查看 历史
德育处主任 提交于 2年前 . 图案笔刷
<!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>图案笔刷 PatternBrush</title>
</head>
<body>
<canvas id="c" width="400" height="400" style="border: 1px solid #ccc;"></canvas>
<script src="../../../script/fabric.js"></script>
<script>
// 初始化
const canvas = new fabric.Canvas('c')
canvas.isDrawingMode = true
let img = new Image();
img.src = '../../../images/bubble.jpg'
img.onload = function() {
let texturePatternBrush = new fabric.PatternBrush(canvas);
texturePatternBrush.source = img;
texturePatternBrush.width = 50
canvas.freeDrawingBrush = texturePatternBrush
}
</script>
</body>
</html>
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/k21vin/fabricjs-demo.git
git@gitee.com:k21vin/fabricjs-demo.git
k21vin
fabricjs-demo
Fabric.js学习资料(中文教程)
master

搜索帮助