three实现三维彩色气球组成爱心旋转动画表白效果代码
代码语言:html
所属分类:表白
代码描述:three实现三维彩色气球组成爱心旋转动画表白效果代码
代码标签: three 三维 彩色 气球 组成 爱心 旋转 动画 表白
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> @import url("https://fonts.googleapis.com/css2?family=Asap&display=swap"); * { margin: 0; padding: 0; box-sizing: border-box; } html, body { /* background: hsl(320deg, 100%, 2%); */ overscroll-behavior-x: none; overscroll-behavior-y: none; } body { font-family: "Asap", sans-serif; position: relative; width: 100vw; height: 100vh; text-align: center; overflow-x: hidden; background: radial-gradient( circle farthest-corner, hsl(320deg, 100%, 11%), hsl(320deg, 100%, 2%) 100% ); } canvas { -moz-user-select: none; -webkit-user-select: none; -ms-user-select: none; user-select: none; position: fixed; width: 100%; height: 100%; top: 0; left: 0; z-index: 1; } </style> </head> <body> <canvas id="canvas"></canvas> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/es-module-shims.1.6.2.js"></script> <script type="importmap"> { "imports": { "three": "//repo.bfw.wiki/bfwrepo/js/module/three/build/154/three.module.js", "three/addons/": "//repo.bfw.wiki/bfwrepo/js/module/three/examples/154/jsm/", "three-mesh-bvh": "//repo.bfw.wiki/bfwrepo/js/module/three/three-mesh-bvh.module.js", "three-bvh-csg": "//repo.bfw.wiki/bfwrepo/js/module/three/three-bvh-csg.module.js" } } </script> <script type="module"> import * as THREE from "three"; import { OrbitControls as e } from "three/addons/controls/OrbitControls.js"; import { MeshSurfaceSampler as t } from "three/addons/math/MeshSurfaceSampler.js"; import * as BufferGeometryUtils from "three/addons/utils/BufferGeometryUtils.js"; import { SUBTRACTION as n, ADDITION as a, Brush as i, Evaluator as r } from "three-bvh-csg"; !function () { "use strict"; function o() { (c = new THREE.Scene()).environment = R, (d = new THREE.WebGLRenderer({ canvas: canvas, antialias: !0, alpha: !0 })). setPixelRatio(window.devicePixelRatio), d.setSize(window.innerWidth, window.innerHeight), d.useLegacyLights = !1, (E = new THREE.PerspectiveCamera( 35, window.innerWidth / window.innerHeight, 0.1, 3 * M)). position.set(0, 0, M * Math.sqrt(2)), E.lookAt(0, 0, 0); const o = new THREE.AmbientLight(16777215, 0.3); c.add(o); const H = new THREE.DirectionalLight(16777215, 1); H.position.set(0, 2 * M, 0), c.add(H), c.fog = new THREE.FogExp2(16101802, 0.005), (w = new e(E, d.domElement)).autoRotate = !0, w.autoRotateSpeed = 2, w.enableDamping = !0, w.enablePan = !1, w.minDistance = 2, w.maxDistance = 2 * M, w.target.set(0, 0, 0), w.update(), p = new THREE.MeshStandardMaterial({ metalness: 1, roughness: 0 }.........完整代码请登录后点击上方下载按钮下载查看
网友评论0