three模拟三维大脑神经元激活动画效果代码
代码语言:html
所属分类:动画
代码描述:three模拟三维大脑神经元激活动画效果代码
代码标签: three 模拟 三维 大脑 神经元 激活 动画
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
body {
margin: 0;
padding: 0;
overflow: hidden;
background-color: #000000;
}
.webgl {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
</style>
</head>
<body translate="no">
<canvas class="webgl"></canvas>
<script type="module">
import * as THREE from "https://esm.sh/three";
import { mergeGeometries } from "https://esm.sh/three/addons/utils/BufferGeometryUtils.js";
import { EffectComposer } from "https://esm.sh/three/addons/postprocessing/EffectComposer.js";
import { RenderPass } from "https://esm.sh/three/addons/postprocessing/RenderPass.js";
import { HalftonePass } from "https://esm.sh/three/addons/postprocessing/HalftonePass.js";
import { OutputPass } from "https://esm.sh/three/addons/postprocessing/OutputPass.js";
import { interpolateRdBu } from "https://esm.sh/d3-scale-chromatic";
import { scaleSequential } from "https://esm.sh/d3-scale";
import seedrandom from "https://esm.sh/seedrandom";
import { createTimeline, animate } from "https://esm.sh/animejs";
//SCENE
const scene = new THREE.Scene();
scene.background = new THREE.Color("#9FCCF9");
//HEMISPHERE LIGHT
const hemisphereLight = new THREE.HemisphereLight(0xffffff, 0xcccccc, 3);
hemisphereLight.intensity = 3;
hemisphereLight.position.set(10, 0, 5);
scene.add(hemisphereLight);
// CAMERA
const camera = new THREE.PerspectiveCamera();
camera.near = 0.001;
camera.far = 1000;
camera.position.set(0, 0, 10);
camera.lookAt(new THREE.Vector3(0, 0, 0));
const cameraAnchor = new THREE.Group();
cameraAnchor.name = "cameraAnchor";
cameraAnchor.add(camera);
scene.add(cameraAnchor);
//RENDERER
const canvas = document.querySelector("canvas.webgl");
const renderer = new THREE.WebGLRenderer({
canvas,
preserveDrawingBuffer: true,
antialias: true
});
const composer = new EffectComposer(renderer);
composer.addPass(new RenderPass(scene, camera));
const params = {
shape: 1,
radius: 1,
rotateR: Math.PI / 12,
rotateB: Math.PI / 12 * 2,
rotateG: Math.PI / 12 * 3,
scatter: 0,
blending: 1,
blendingMode: 1,
greyscale: false,
disable: false
};
const halfToneEffect = new HalftonePass(params);
composer.addPass(halfToneEffect);
const outputEffect = new OutputPass();
composer.addPass(outputEffect);
//HELPER FUNCTIONS
// Normalized mnist digit '6' data
function getMnistData() {
return [
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.494, 0.761, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.169, 0.878, 0.298, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.02, 0.82, 0.694, 0.024, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.459, 0.898, 0.153, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.263, 0.902, 0.404, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.086, 0.933, 0.588, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.702, 0.925, 0.098, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.427, 0.984, 0.216, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.149, 0.761, 0.792, 0.047, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.525, 0.996, 0.318, 0, 0.027, 0.427, 0.722, 0.671, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.169, 0.953, 0.698, 0.024, 0.075, 0.561, 0.961, 0.996, 0.996, 0.169, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.075, 0.71, 0.855, 0.114, 0.169, 0.804, 0.996, 0.757, 0.569, 0.996, 0.31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.353, 1, 0.38, 0.251, 0.855, 0.973, 0.38, 0, 0.259, 0.996, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, .........完整代码请登录后点击上方下载按钮下载查看
















网友评论0