p5实现海边落日余晖波动动画效果代码

代码语言:html

所属分类:动画

代码描述:p5实现海边落日余晖波动动画效果代码

代码标签: p5 海边 落日 余晖 波动 动画

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

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

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

  
  
<style>
* {
  box-sizing: border-box;
}
html, body {
  margin: 0;
  padding: 0;
}

canvas {
  width: 500px;
  height: 500px;
  max-width: 100vw;
	max-height: 100vh;
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
}
</style>

  
  
</head>

<body translate="no">
  
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/p5.1.6.0.js"></script>
      <script  >
console.clear();

const pointCount = 30;
const points = [];

class Point {
  constructor(perc) {
    const angle = PI*.5*perc;
    this.x = cos(angle);
    this.y = sin(angle);
  }
}

function setup() {
  createCanvas(windowWidth,windowHeight);
  for(let i = 0; i < pointCount -2; i++) {
    points.push(new Point(i/pointCount))
  }
}

function draw() {
  const s = min(width,height) * .75;
  const sw = s * .05;
  
  rectMode(CENTER)
  strokeJoin(ROUND);
  strokeWeight(sw);
  
  translate(width*.5, height*..........完整代码请登录后点击上方下载按钮下载查看

网友评论0