p5实现旋涡动画效果代码
代码语言:html
所属分类:动画
代码描述:p5实现旋涡动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> </head> <body> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/p5.1.4.0.js"></script> <script > 'use strict'; console.clear(); var PHI = 1.6180339887; // config var bg = '#FFF', col = 125, dZ = 1, dR = 5; // globals/deferred inits var cone, cam, r, r_max, z, z_spacing; var setup = function () { createCanvas(window.innerWidth, window.innerHeight, WEBGL); smooth(); stroke(255, 255, 255, 50); r = r_max = sqrt(Math.pow(width, 2) + Math.pow(height, 2)); z = z_spacing = floor(r_max * 0.0275); cone = new GoldenCone(r, dR, dZ, z_spacing, 0, col); var camDist = r_max * 1 / 2; cam = createCamera(); cam.setPosition(-camDist, camDist, camDist * 2); setCamera(cam); }; var draw = function () { background(bg); cam.lookAt(0, 0, 0); orbitControl(); cone.update(); cone.display(); }; var GoldenCone = /** @class */ (function () { function GoldenCone(r, dR, dZ, sp, s, c) { this.a = []; this.r = r.........完整代码请登录后点击上方下载按钮下载查看
网友评论0