当前位置:网站首页>【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);
设置形状的填充色。

三、绘制基础形状

边栏推荐
猜你喜欢

一篇带你走近Kubernetes概貌与原理

Solve package is not available (for R ve [package 'xxx' is not available (for R version x.y.z) "warning?]

【C语言笔记分享】自定义类型:结构体,枚举,联合(建议收藏)

软件测试真有网上说的那么好吗?

Database performance analysis and optimization (internal training materials of Aite future team)
![【C语言进阶】——指针进阶[Ⅰ]](/img/62/d3410a61b931177fc02c1801489b5a.png)
【C语言进阶】——指针进阶[Ⅰ]

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

easyui tree

MySQL optimization summary

Generation and use of dynamic link library (error summary)
随机推荐
Database optimization -- deeply understand the underlying data structure and algorithm of MySQL index
软件测试需求人才越来越多,走上测试道路的人却越来越少?
[阅读笔记] For:Object Detection with Deep Learning: The Definitive Guide
PCA reports error in eigen (crossprod (t (x), t (x)), symmetric = true): 'x' has infinite value or missing value
软件测试培训两个月可以就业吗?
【C语言笔记分享】——动态内存管理malloc、free、calloc、realloc、柔性数组
Students' 20 R language exercises
【C语言笔记分享】字符函数和字符串函数(建议收藏)
培训软件测试能不能就业
电工学自学笔记1.22
软件测试就业前景如何?
Strsplit() function
Sql Server STUFF与FOR XML PATH
JVM性能调优
Convert the image file of input type='file'to Base64
Ros自定义消息及使用
JDWP未授权快速利用
100+ collection of medical image data sets
电工学下册自学笔记1.23
Jdwp unauthorized rapid utilization