一 概述
- createP语法介绍
- createP示例
二 createP语法介绍
2.1 语法
createP([html])
2.2 说明
- 创建一个段落(Paragraph)
- 可以级联使用p5.Element的语法
2.3 参数及返回值
参数 | 返回值 |
---|---|
创建段落(Paragraph)时默认的字符串 | p5.Element |
三 示例
3.1 实例一
代码(分开使用)
function setup() {
let p = createP('this is some text');
p.style('font-size', '16px');
p.position(10, 0);
}
效果图
3.2 示例二(级联使用)
代码
function setup() {
let p = createP('this is some text')
.style('font-size', '16px')
.position(10, 0)
.html("createP补充",true);
}