当前位置:网站首页>【p5.js学习笔记】码绘的基础知识
【p5.js学习笔记】码绘的基础知识
2022-07-28 16:34:00 【至肝主义圈毛君】
目录
1. 准备画布: createCanvas(720, 400);
2. 设置背景颜色: background(r,g,b,a); / background(gray)
3. 是否绘制形状:noStroke(); / noFill();
在线编辑器:https://editor.p5js.org/#
参考文档:https://p5js.org/zh-Hans/reference/
官方示例:https://p5js.org/zh-Hans/examples/
一、绘前准备
1. 准备画布: createCanvas(720, 400);
制作一个 720 像素宽 400 像素高的画布。
2. 设置背景颜色: background(r,g,b,a); / background(gray)
常用形式:传入参数为RGBA四个通道值 或 一个灰度值。
其余形式参考 https://p5js.org/zh-Hans/reference/#/p5/background
3. 是否绘制形状:noStroke(); / noFill();
如果 noStroke() 和 noFill() 都被调用的话,没有形状会被画在荧幕上。
二、选择绘制模式
1. 绘制边框:stroke(r,g,b,a);
设置形状的外形线色。这颜色可用 RGB 或 HSB 颜色定义,取决于当时的颜色模式(默认色彩空间是 RGB,而每个数值都介于 0 至 255 之间)。默认透明度值也介于 0 至 255 之间。
如果所提供的参数是单一字符串,RGB、RGBA 和十六进制 CSS 颜色字符串及所有命名颜色都可以使用。在这情况下,提供第二个参数以定义透明度值并不被支持,而需使用 RGBA 字符串。
stroke('red'); // 设置笔锋颜色
strokeWeight(4); // 设置笔锋粗细
2. 填充边框:fill(r,g,b,a);
设置形状的填充色。

三、绘制基础形状

边栏推荐
- Factor in R
- Mqtt.fx connects to Alibaba cloud Internet of things platform
- 三维点云处理系列----PCA
- Talk about what you know about publishing online (I)
- PCA 报错Error in eigen(crossprod(t(X), t(X)), symmetric = TRUE) : ‘x‘里有无穷值或遗漏值
- 解决Package is not available (for R ve【PACKAGE ‘XXX’ IS NOT AVAILABLE (FOR R VERSION X.Y.Z)” WARNING?】
- 【C语言进阶】——指针进阶[Ⅰ]
- Public medical database
- 多大适合学习软件测试?
- 软件测试培训机构可靠吗?
猜你喜欢

Jerry ac1082/1074/1090 development record

Ggplot2 map

Please make sure you have the correct access rights and the repository exists.

PCA 报错Error in eigen(crossprod(t(X), t(X)), symmetric = TRUE) : ‘x‘里有无穷值或遗漏值

Management of third-party technical services in product development

Mysql 优化总结

Esp-mqtt-at instruction connects Alibaba cloud Internet of things platform

es6 Promise

MySQL面试题大全(陆续更新)

Arya-专业web自动化测试平台
随机推荐
新手通过自学转行软件测试难度大吗?
mmdetection3d(3)---网络输出
R语言 sub()用法
零基础学习软件测试有什么条件?
Map R language
Solve package is not available (for R ve [package 'xxx' is not available (for R version x.y.z) "warning?]
.net MVC的理解
.net动态调用webservice的三种方式
How important is baseline safety from non child websites
Talk about the measurement of "post release problems"
hgu95av2.在线安装失败
JVM performance tuning
[阅读笔记]-2 通过朴素贝叶斯模型学习机器学习分类
Alibaba P8 architect talk: seven knowledge points (including interview questions) that must be learned well to become an architect
Factor in R
Sql Server STUFF与FOR XML PATH
mmdetection3D---(1)
Ggplot2 map
In depth sharing of Ali (ant financial) technical interview process, with preliminary preparation and learning direction
软件测试零基础入门好学吗?