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: black;
}
</style>


</head>

<body >

<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/p5.1.4.0.js"></script>
      <script >
//gravity - changing this will change the speed of thought
let g = 9.81;
//I have been told that mathematicians use these single-letter poorly explained variables.
let a,c;
//colorMode
let cMode = 0;
//because arrows seemed like something we can can focus on
setup = () => {
  c = min(windowWidth, windowHeight) * 0.9;//clearly a variable
  createCanvas(windowWidth, windowHeight);
  a = -c / 3;
  stroke(255 - cMode);
  strokeWeight(0.5);
  noFill();
};
draw = () => {
  background(cMode);
  stroke(255 - cMode);
  //you can play with time itself - it's relative - maybe you should conceptualize non-linear time
  t = frameCount / 7;
  //the origin of thought is now centered:
  translate(width / 2, height / 2); 
  strokeWeight(2);
  for (let i = 0.7; i < 40; i += 0.5) {
    push();
    //shrinking thoughts
    scale(1 / i, 1 / i);
    circle(0, -c / 4, 5);
    pendulum(2 * i);
    po.........完整代码请登录后点击上方下载按钮下载查看

网友评论0