当前位置:网站首页>Fabric.js 笔刷到底怎么用?
Fabric.js 笔刷到底怎么用?
2022-06-28 09:56:00 【InfoQ】
本文简介
Fabric.jsFabricFabric.js 5.2.1常用的配置
起步

<canvas id="c" width="600" height="400" style="border: 1px solid #ccc;"></canvas>
<!-- 引入 Fabric.js -->
<script src="https://cdn.bootcdn.net/ajax/libs/fabric.js/521/fabric.js"></script>
<script>
const canvas = new fabric.Canvas('c', {
isDrawingMode: true // 开启绘画模式
})
</script>
isDrawingModetrueisDrawingModetrueisDrawingModecanvas.isDrawingMode = true设置笔刷宽度

// 省略 “起步” 代码
canvas.freeDrawingBrush.width = 20 // 画笔宽度
width设置笔刷颜色

// 省略 “起步” 代码
canvas.freeDrawingBrush.width = 20 // 画笔宽度
canvas.freeDrawingBrush.color = 'pink' // 画笔颜色
虚线

// 省略 “起步” 代码
canvas.freeDrawingBrush.width = 20 // 画笔宽度
canvas.freeDrawingBrush.strokeDashArray = [20, 50] // 行程破折号数组
strokeDashArray投影

// 省略 “起步” 代码
canvas.freeDrawingBrush.width = 20 // 画笔宽度
// 画笔投影
canvas.freeDrawingBrush.shadow = new fabric.Shadow({
blur: 10, // 羽化程度
offsetX: 10, // x轴偏移量
offsetY: 10, // y轴偏移量
color: '#30e3ca' // 投影颜色
})
自由绘制被限制为画布大小

// 省略 “起步” 代码
canvas.freeDrawingBrush.width = 20 // 画笔宽度
canvas.freeDrawingBrush.limitedToCanvasSize = true // 当“ true”时,自由绘制被限制为画布大小。
线条结尾的画笔风格
canvas.freeDrawingBrush.strokeLineCap = 'round'
roundbuttsquareround画笔的角落风格
canvas.freeDrawingBrush.strokeLineJoin = 'miter'
miterbevelround设置笔刷的最大斜接长度
canvas.freeDrawingBrush.strokeLineJoin = 'miter' // 画笔的角落风格
canvas.freeDrawingBrush.strokeMiterLimit = 10 // 最大斜接长度
strokeMiterLimitstrokeLineJoinmiter啰嗦两句
Fabric.js- 在线PS画板
- 在线批改操作
Fabric.jsFabric.jsFabric.js代码仓库
边栏推荐
- Cisco * VRF(虚拟路由转发表)
- 纵观jBPM从jBPM3到jBPM5以及Activiti
- 引入 flink-sql-mysql-cdc-2.2.1 好多依赖冲突,有解决的吗?
- Key summary V of PMP examination - execution process group
- Inventory of excellent note taking software: good-looking and powerful visual note taking software, knowledge map tools heptabase, hydrogen map, walling, reflect, infranodus, tiddlywiki
- PMP考试重点总结六——图表整理
- Bron filter Course Research Report
- [200 opencv routines] 213 Draw circle
- flink cep 跳过策略 AfterMatchSkipStrategy.skipPastLastEvent() 匹配过的不再匹配 碧坑指南
- Thread lifecycle
猜你喜欢

Numpy array: join, flatten, and add dimensions

卸载oracle报错

通过PyTorch构建的LeNet-5网络对手写数字进行训练和识别
![QT signal and slot communication mechanism (when multiple windows communicate back and forth [parent and child windows])](/img/17/57ffb7393b71eddc5ac92ae3944338.jpg)
QT signal and slot communication mechanism (when multiple windows communicate back and forth [parent and child windows])

Explain final, finally, and finalize

代理模式(Proxy)

函数的分文件编写

错过金三银四,找工作4个月,面试15家,终于拿到3个offer,定级P7+

Dbeaver installation and use tutorial (super detailed installation and use tutorial)

mysql打不开,闪退
随机推荐
缓存之王Caffeine Cache,性能比Guava更强
Explain final, finally, and finalize
引入 flink-sql-mysql-cdc-2.2.1 好多依赖冲突,有解决的吗?
[200 opencv routines] 213 Draw circle
MySQL基础知识点总结
[Unity]EBUSY: resource busy or locked
[Unity][ECS]学习笔记(三)
错过金三银四,找工作4个月,面试15家,终于拿到3个offer,定级P7+
JVM family (2) - garbage collection
Unity AssetBundle asset packaging and asset loading
Matplotlib属性及注解
Unity loads AssetBundle resources from the server and writes them to local memory, and loads the downloaded and saved AB resources from local memory to the scene
The R language uses the avplots function in the car package to create added variable plots. In image interaction, manually identify (add) strong influence points that have a great impact on each predi
idea连接sql sever失败
Sword finger offer | linked list transpose
Install using snap in opencloudos NET 6
我大抵是卷上瘾了,横竖睡不着!竟让一个Bug,搞我两次!
PMP考试重点总结七——监控过程组(1)
第五章 树和二叉树
云服务器MYSQL查询速度慢