p5实现缎子边角艺术画作效果代码

代码语言:html

所属分类:其他

代码描述:p5实现缎子边角艺术画作效果代码

代码标签: p5 缎子 艺术 画作

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">





    <style>
        body {
          margin: 0;
          padding: 0;
          height: 100vh;
          overflow: hidden;
          display: flex;
          align-items: center;
          justify-content: center;
          background: grey;
        }
    </style>

</head>

<body>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/p5.1.4.0.js"></script>
    <script>
     function setup() {
  cnv = createCanvas(windowHeight * 0.5, windowHeight * 0.9);
  background(255);
  fill(0);
  noLoop();
}
function draw() {
  translate(width / 2, 0);
  push();
  scale(0.02, random(1,1.3));
  outer(
    height / 1.5,
    random(60, 100),
    random(60, 100),
    random(10, 40),
    random(20, 90),
    random(10, 90),
    random(0.5,2)
  );
  pop();
  push();
  scale(random(0.03,0.06), random(1,1.3));
  outer(
    height / 1.5,
    random(10, 40),
    random(10, 40),
    random(10, 40),
    random(20, 90),
    random(10, 90),
    random(0.5,2)
  );
  pop();
  push();
  scale(random(0.1,0.25), random(1,1.3));
  outer(
    height / 1.5,
    random(190, 220),
    random(190, 220),
    random(170, 210),
    random(20, 90),
    random(10, 40),
    random(0.5,2)
  );
  pop();

  push();
  scale(0.3, 1);
  outer(
    height / 1.5,
    random(20, 70),
    random(40, 80),
    random(60, 100),
    random(10, 40),
    random(10, 40),
    random(0.5,2)
  );
.........完整代码请登录后点击上方下载按钮下载查看

网友评论0