p5实现三维彩色光环扭曲动画效果代码

代码语言:html

所属分类:三维

代码描述:p5实现三维彩色光环扭曲动画效果代码,可旋转操作。

代码标签: 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.0.7.2.js"></script>
    <script>
    var _createClass = function() {
    function a(e, d) {
        for (var c = 0; c < d.length; c++) {
            var b = d[c];
            b.enumerable = b.enumerable || false;
            b.configurable = true;
            if ("value" in b) {
                b.writable = true
            }
            Object.defineProperty(e, b.key, b)
        }
    }
    return function(b, c, d) {
        if (c) {
            a(b.prototype, c)
        }
        if (d) {
            a(b, d)
        }
        return b
    }
}();

function _classCallCheck(b, a) {
    if (!(b instanceof a)) {
        throw new TypeError("Cannot call a class as a function")
    }
}
console.clear();
var h = window.innerHeight,
    w = window.innerWidth;
var rMajor = 400,
    rMinor = 145,
    slices = 270,
    tubeSides = 3,
    twistRate = 2e-05,
    twists = 6;
var torus;

function setup() {
    createCanvas(w, h, WEBGL);
    torus = new TwistedTorus(rMajor, rMinor, slices, tubeSides, twistRate);
    noStroke();
    camera(0, -rMajor * 2, rMajor * 2.3, 0, 0, 0, 0, 1, 0);
    var c = rMajor + rMinor;
    for (var b = 0; b < TAU; b += TAU / 7) {
        pointLight(120, 120, 120, c * cos(b), -rMinor * 3 / 2, c * sin(b))
    }
    directionalLight(75, 75, 75, 1, 0, -1);
    colorMode(HSL)
}

function draw() {
    orbitControl();
    background(0);
    torus.convolve();
    torus.display();
    sphere(0)
}
var TwistedTorus = function() {
    funct.........完整代码请登录后点击上方下载按钮下载查看

网友评论0