p5实现八面体定点旋转动画效果代码
代码语言:html
所属分类:动画
代码描述:p5实现八面体定点旋转动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> </head> <body> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/p5.js"></script> <script> let ax, ay, bx, by, cx, cy, fx, fy, gx, gy, hx, hy; function setup() { createCanvas(600, 600); stroke(255); background(0); } function draw() { background(0, 0, 0, 5); translate(width / 2, width / 2); t = frameCount / 70; rotate(t / 20); stroke(200 + 55 * sin(t), 200 + 55 * cos(t / 2), 200 + 55 * cos(t)); octoRave(); } function octoRave() { ax = 50 * sin(t) + 50 * cos(t / 3) + 20; ay = 50 * cos(t) + 50 * sin(t); bx = -50 * sin(t) - 100 * cos(t) + 10; by = 50 * cos(t / 2) + 100 * cos(t / 2); cx = sin(t); cy = 100 * cos(.........完整代码请登录后点击上方下载按钮下载查看
网友评论0