当前位置:网站首页>[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

边栏推荐
- [untitled]
- 电工学自学笔记1.20
- Ggplot2 map
- Sql Server STUFF与FOR XML PATH
- [C language note sharing] - dynamic memory management malloc, free, calloc, realloc, flexible array
- The difference between using switch in a loop and using break and continue after executing a condition
- 电脑充不进去电的解决方法
- 【C语言必看】哟写BUG呢,我敢保证你踩过坑
- 1.1-注释
- 软件测试需求人才越来越多,走上测试道路的人却越来越少?
猜你喜欢

In depth sharing of Ali (ant financial) technical interview process, with preliminary preparation and learning direction

abstract、static、final

2.2-数据类型

2022 IDEA (学生邮箱认证)安装使用教程以及基础配置教程

QT编写串口助手

Interviewer: the actual record of algorithm question brushing.pdf I can't even answer it

Can‘t use an undefined value as an ARRAY reference at probe2symbol

Jerry ac1082/1074/1090 development record

Factor in R
![[C language note sharing] character function and string function (recommended Collection)](/img/0a/90cd617e3622d95f9bfc3e945a298a.png)
[C language note sharing] character function and string function (recommended Collection)
随机推荐
【Unity Scriptable Object】教程 | 在Unity中使用 Scriptable Object 存储物体数据信息
Please make sure you have the correct access rights and the repository exists.
R language sub() usage
【C语言笔记分享】字符函数和字符串函数(建议收藏)
PyTorch中grid_sample的使用方法
Alibaba P8 architect talk: seven knowledge points (including interview questions) that must be learned well to become an architect
[C language note sharing] - dynamic memory management malloc, free, calloc, realloc, flexible array
[C language must see] yo, writing bugs, I'm sure you've stepped on the pit
软件测试工程师如何突破职业发展瓶颈
3.2-随机数
Branch and loop (for and do while)
ROS system installation
Internal class, common class
关于非递归和递归分别实现求第n个斐波那契数
【C语言笔记分享】自定义类型:结构体,枚举,联合(建议收藏)
JVM performance tuning
ROS零散知识点及错误解决
软件测试培训需要多久?
[C language note sharing] character function and string function (recommended Collection)
Hgu95av2. Online installation failed