three实现三维粒子流旋转动画效果代码
代码语言:html
所属分类:三维
代码描述:three实现三维粒子流旋转动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
</head>
<body translate="no">
<div id="scene-container"></div>
<style>
#scene-container {
width: 100%;
height: 100vh;
}
body {
margin: 0;
overflow: hidden;
background-color: #000;
}
</style>
<script type="importmap">
{
"imports": {
"three": "https://cdn.jsdelivr.net/npm/three@0.169.0/build/three.module.js",
"three/addons/controls/OrbitControls": "https://cdn.jsdelivr.net/npm/three@0.169.0/examples/jsm/controls/OrbitControls.js",
"three/addons/postprocessing/EffectComposer": "https://cdn.jsdelivr.net/npm/three@0.169.0/examples/jsm/postprocessing/EffectComposer.js",
"three/addons/postprocessing/RenderPass": "https://cdn.jsdelivr.net/npm/three@0.169.0/examples/jsm/postprocessing/RenderPass.js",
"three/addons/postprocessing/ShaderPass": "https://cdn.jsdelivr.net/npm/three@0.169.0/examples/jsm/postprocessing/ShaderPass.js",
"three/addons/postprocessing/UnrealBloomPass": "https://cdn.jsdelivr.net/npm/three@0.169.0/examples/jsm/postprocessing/UnrealBloomPass.js",
"three/addons/postprocessing/OutputPass": "https://cdn.jsdelivr.net/npm/three@0.169.0/examples/jsm/postprocessing/OutputPass.js"
}
}
</script>
<script type="module">
import * as THREE from 'three';
import { OrbitControls } from 'three/addons/controls/OrbitControls';
import { EffectComposer } from 'three/addons/postprocessing/EffectComposer';
import { RenderPass } from 'three/addons/postprocessing/RenderPass';
import { ShaderPass } from 'three/addons/postprocessing/ShaderPass';
import { UnrealBloomPass } from 'three/addons/postprocessing/UnrealBloomPass';
import { OutputPass } from 'three/addons/postprocessing/OutputPass';
let scene, camera, renderer, controls, clock, composer;
let prismCore, energyVeins, crystalShards, particleField, pointLight, rayParticles;
let mouse = new THREE.Vector2(0, 0);
let targetRotation = new THREE.Vector2(0, 0);
let rayParticleCount = 1000;
let colorScheme = {
primary: new THREE.Color(0x12A4D9),
secondary: new THREE.Color(0xD9138A),
accent: new THREE.Color(0xE2D810),
dark: new THREE.Color(0x322E2F)
};
init();
animate();
function init() {
scene = new THREE.Scene();
scene.fog = new THREE.FogExp2(0x000000, 0.035);
camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
camera.position.set(0, 1.8, 4.0);
renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true });
renderer.setSize(window.innerWidth, window.innerHeight);
.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0