当前位置:网站首页>Fabric. How to use js brush?
Fabric. How to use js brush?
2022-06-28 10:14:00 【InfoQ】
Brief introduction
Fabric.jsFabricFabric.js 5.2.1Common configuration
start

<canvas id="c" width="600" height="400" style="border: 1px solid #ccc;"></canvas>
<!-- introduce 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 // Turn on painting mode
})
</script>
isDrawingModetrueisDrawingModetrueisDrawingModecanvas.isDrawingMode = trueSet the brush width

// Omit “ start ” Code
canvas.freeDrawingBrush.width = 20 // The width of the brush
widthSet brush color

// Omit “ start ” Code
canvas.freeDrawingBrush.width = 20 // The width of the brush
canvas.freeDrawingBrush.color = 'pink' // Brush color
Dotted line

// Omit “ start ” Code
canvas.freeDrawingBrush.width = 20 // The width of the brush
canvas.freeDrawingBrush.strokeDashArray = [20, 50] // Stroke dash array
strokeDashArrayProjection

// Omit “ start ” Code
canvas.freeDrawingBrush.width = 20 // The width of the brush
// Brush projection
canvas.freeDrawingBrush.shadow = new fabric.Shadow({
blur: 10, // The degree of eclosion
offsetX: 10, // x Shaft offset
offsetY: 10, // y Shaft offset
color: '#30e3ca' // Projection color
})
Freehand painting is limited to canvas size

// Omit “ start ” Code
canvas.freeDrawingBrush.width = 20 // The width of the brush
canvas.freeDrawingBrush.limitedToCanvasSize = true // When “ true” when , Freehand painting is limited to canvas size .
Brush style at the end of the line
canvas.freeDrawingBrush.strokeLineCap = 'round'
roundbuttsquareroundThe corner style of the brush
canvas.freeDrawingBrush.strokeLineJoin = 'miter'
miterbevelroundSet the maximum miter length of the brush
canvas.freeDrawingBrush.strokeLineJoin = 'miter' // The corner style of the brush
canvas.freeDrawingBrush.strokeMiterLimit = 10 // Maximum miter length
strokeMiterLimitstrokeLineJoinmiterlong-winded
Fabric.js- On-line PS Drawing board
- Online correction operation
Fabric.jsFabric.jsFabric.jsCode warehouse
边栏推荐
- 【NLP】今年高考英语AI得分134,复旦武大校友这项研究有点意思
- 缓存之王Caffeine Cache,性能比Guava更强
- 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
- idea连接sql sever失败
- ECS MySQL query is slow
- Dotnet uses crossgen2 to readytorun DLL to improve startup performance
- 一文读懂 12种卷积方法(含1x1卷积、转置卷积和深度可分离卷积等)
- [Unity][ECS]学习笔记(一)
- 4 methods for exception handling
- 装饰模式(Decorator)
猜你喜欢
![[200 opencv routines] 213 Draw circle](/img/8d/a771ea7008f84ae3a3cf41507448ec.png)
[200 opencv routines] 213 Draw circle

An error is reported when uninstalling Oracle
![[happy Lantern Festival] guessing lantern riddles eating lantern festival full of vitality ~ (with lantern riddle guessing games)](/img/04/454bede0944f56ba69cddf6b237392.jpg)
[happy Lantern Festival] guessing lantern riddles eating lantern festival full of vitality ~ (with lantern riddle guessing games)

Solve the problem that the value of the action attribute of the form is null when transferring parameters

PMP examination key summary VIII - monitoring process group (2)

Understand 12 convolution methods (including 1x1 convolution, transpose convolution and deep separable convolution)

Au revoir! Navigateur ie, cette route Edge continue pour IE
![[Unity]EBUSY: resource busy or locked](/img/72/d3e46a820796a48b458cd2d0a18f8f.png)
[Unity]EBUSY: resource busy or locked

Ideal interface automation project

Key summary V of PMP examination - execution process group
随机推荐
Application of X6 in data stack index management
【云驻共创】DWS告警服务DMS详细介绍和集群连接方式简介
Resolution: overview of decentralized hosting solution
MySQL基础知识点总结
JVM family (2) - garbage collection
[happy Lantern Festival] guessing lantern riddles eating lantern festival full of vitality ~ (with lantern riddle guessing games)
【NLP】今年高考英语AI得分134,复旦武大校友这项研究有点意思
Dolphin scheduler uses system time
R语言使用car包中的avPlots函数创建变量添加图(Added-variable plots)、在图像交互中,在变量添加图中手动标识(添加)对于每一个预测变量影响较大的强影响点
Installing redis under Linux and windows (ultra detailed graphic tutorial)
为什么 Istio 要使用 SPIRE 做身份认证?
Teach you how to handle the reverse SVG mapping of JS
Please consult me. I run the MYSQL to MySQL full synchronization of flykcdc in my local ide. This is in my local ide
Summary of MySQL basic knowledge points
装饰模式(Decorator)
请教下, 我在本地idea运行flinkcdc的mysql到mysql全量同步,这个是在我本地ide
I'm almost addicted to it. I can't sleep! Let a bug fuck me twice!
Starting from full power to accelerate brand renewal, Chang'an electric and electrification products sound the "assembly number"
接口自动化框架脚手架-参数化工具的实现
[Unity]EBUSY: resource busy or locked