p5实现立体彩色柱体生长环绕动画效果代码

代码语言:html

所属分类:动画

代码描述:p5实现立体彩色柱体生长环绕动画效果代码

代码标签: p5 立体 彩色 柱体 生长 环绕 动画

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

<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  

  
  
  
<style>
body {
  background-color: black;
  display: flex;
  height: 100vh;
  overflow: hidden;
  align-items: center;
  justify-content: center;
}
</style>

  
  
</head>

<body translate="no">
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/p5-1.9.0.js"></script>
      <script >

function setup() {
  createCanvas(500, 500, WEBGL);
  rectMode(CENTER);
  angleMode(DEGREES);
  noStroke();
  n = floor(random(3, 5));
  background(0);
  d1 = random(30, 50);
  d2 = random(5, 40);
  nRot = floor(random(3, 10));
  if (nRot === 4) {
    nRot = 3;
  }
  r1 = random(100, 255);
  g1 = random(100, 255);
  b1 = random(100, 255);
  r2 = random(20, 50);
  g2 = random(20, 50);
  b2 = random(20, 50);
}

function draw() {
  t = frameCount / (3 + n);
  pointLight(
  r1 + r2 * sin(t),
  g1 + g1 * sin(t),
  b1 + b2 * sin(t),
  600,
  600,
  600);
.........完整代码请登录后点击上方下载按钮下载查看

网友评论0