当前位置:网站首页>[p5.js learning notes] basic knowledge of code drawing
[p5.js learning notes] basic knowledge of code drawing
2022-07-28 17:48:00 【Zhigan doctrine circle Maojun】
Catalog
One 、 Preparation before painting
1. Prepare the canvas : createCanvas(720, 400);
2. Set the background color : background(r,g,b,a); / background(gray)
3. Whether to draw shapes :noStroke(); / noFill();
1. bound box :stroke(r,g,b,a);
2. Fill in the border :fill(r,g,b,a);
3、 ... and 、 Draw the base shape
Online editor :https://editor.p5js.org/#
Reference documents :https://p5js.org/zh-Hans/reference/
The official sample :https://p5js.org/zh-Hans/examples/
One 、 Preparation before painting
1. Prepare the canvas : createCanvas(720, 400);
To make a 720 Pixel width 400 Pixel high canvas .
2. Set the background color : background(r,g,b,a); / background(gray)
Common forms : The incoming parameter is RGBA Four channel values or A gray value .
For other forms, please refer to https://p5js.org/zh-Hans/reference/#/p5/background
3. Whether to draw shapes :noStroke(); / noFill();
If noStroke() and noFill() Are called , No shape will be painted on the screen .
Two 、 Select the drawing mode
1. bound box :stroke(r,g,b,a);
Set the shape outline color . This color is available RGB or HSB Color definition , It depends on the color mode at that time ( The default color space is RGB, And each value is between 0 to 255 Between ). The default transparency value is also between 0 to 255 Between .
If the supplied parameter is a single string ,RGB、RGBA And hex CSS Color strings and all named colors can be used . In this case , Providing a second parameter to define transparency values is not supported , It needs to be used RGBA character string .
stroke('red'); // Set the stroke color
strokeWeight(4); // Set the stroke thickness 
2. Fill in the border :fill(r,g,b,a);
Set the fill color of the shape .

3、 ... and 、 Draw the base shape

边栏推荐
- 1.4-dos
- [advanced C language] - Advanced pointer [i]
- 【机器学习笔记】Regularization : Ridge Regression(岭回归)
- [untitled]
- 软件测试工作内容太简单怎么办?
- 【C语言进阶】——指针进阶[Ⅰ]
- 【C语言笔记分享】——动态内存管理malloc、free、calloc、realloc、柔性数组
- 如何看软件测试未来的发展?
- [C language note sharing] character function and string function (recommended Collection)
- 点云处理--voxel filter
猜你喜欢

JVM performance tuning
![【C语言进阶】——剖析入微数据在内存中的存储[上]](/img/6a/ac723cee2543cd2403a7e58d556c8e.png)
【C语言进阶】——剖析入微数据在内存中的存储[上]
![[C language note sharing] custom type: structure, enumeration, Union (recommended Collection)](/img/25/4a17c260b2b506ae1224520d9b85d1.png)
[C language note sharing] custom type: structure, enumeration, Union (recommended Collection)

Hgu95av2. Online installation failed

USB virtual serial port (CDC) limit speed test

QT编写串口助手

【p5.js学习笔记】码绘的基础知识

How to install PS filter plug-in

es6 Promise

Internal class, common class
随机推荐
点云处理---二叉树
软件测试零基础小白学习需要掌握哪些技能?
On the non recursive and recursive implementation of finding the nth Fibonacci number respectively
【Unity Tilemap】教程 | Basic、Rule Tile、Prefab Brush、Tilemap Collider
阿里云天池大赛赛题解析(深度学习篇)--阅读笔记1--赛题一
pycharm连接到远程docker
编译原理学习笔记1(编译原理概述与词法分析)
【C语言必看】哟写BUG呢,我敢保证你踩过坑
Distinguish between the export of ES6 and the module.exports of nodejs
[阅读笔记] For Paper:R-CNN系列的三篇论文总结
1.2-进制转换
【机器学习笔记】Regularization : Ridge Regression(岭回归)
USB virtual serial port (CDC) limit speed test
零基础软件测试培训可靠吗?
Collection集合
【Unity】三张图让你看懂ShaderGraph编辑器
软件测试工程师如何突破职业发展瓶颈
小白必看的软件测试发展路线
Database optimization -- deeply understand the underlying data structure and algorithm of MySQL index
In depth sharing of Ali (ant financial) technical interview process, with preliminary preparation and learning direction