p5实现字母表斑点状绘制动画效果代码
代码语言:html
所属分类:动画
代码描述:p5实现字母表斑点状绘制动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
body {
background: rgb(60, 60, 60);
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
</style>
</head>
<body translate="no">
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/p5.2.0.3.js"></script>
<script >
let t = 0;
function setup() {
cnv = createCanvas(600, 600);
background(70);
angleMode(DEGREES);
rectMode(CENTER);
noStroke();
describe(
"a through z lower case letters being drawn on a dark grey canvas with a splotchy random chalk effect");
}
function draw() {
t += randomGaussian(2, 1);
translate(0, height / 12);
testLetters();
}
function letters(l, w, r) {
push();
fill(40, 40, 40, 2); //,1+10*sin(t/4+r));
rect(0, 0, w * 1.5, w * 3);
noStroke();
translate(0, -w / 2);
s = w / 20 + randomGaussian(0, w / 20);
fill(255 - random(30), 255 - random(30), 255 - random(10));
t1 = t + r + random(-20, 20);
if (l === "a") {
circle(w / 3 * cos(t1), w / 2 + w / 3 * sin(t1), s);
circle(w / 2 - (w / 2 - w / 3), w / 2 + w / 2.5 * sin(t1), s);
}
if (l === "b&.........完整代码请登录后点击上方下载按钮下载查看
网友评论0