three将照片视频进行粒子打碎三维漂浮交互效果代码
代码语言:html
所属分类:粒子
代码描述:three将照片视频进行粒子打碎三维漂浮交互效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <title>Lots of Particles</title> <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" user-scalable="yes"> <style> * { margin: 0; padding: 0; } body { overflow: hidden; } #bg { height: 100vh; background-color: #2A2B2F; } #wrapper { position: relative; background-color: #161616; font-family: 'Josefin Sans', sans-serif; } #canvas_container { position: absolute; left: 0; top: 0; width: 100%; height: 100vh; z-index: 0; } canvas { display: block; } .text { width: 100%; text-align: center; position: absolute; left: 0; top: -80px; font-weight: 600; z-index: 10; cursor: pointer; color: #F9B31C; background-color: rgba(23, 23, 23, 0.9); padding: 10px 0; font-size: 25px; } .btn { position: absolute; bottom: 5%; right: 0px; transform: translateX(-50%); border: 1px solid white; border-radius: 5px; font-size: 0.9rem; padding: 0.5rem 0.7em; background: #2a2b2f; color: #F9B31C; -webkit-font-smoothing: antialiased; font-weight: bold; cursor: pointer; transition: all .3s; z-index: 11; } .btn_works { left: 100px; right: unset; text-decoration: none; } .btn:hover { background: #ffffff; color: #2a2b2f; } </style> </head> <body> <div id="wrapper"> <div id="bg"></div> <div id="canvas_container"></div> <video id="video" playsinline webkit-playsinline muted loop width="280" height="108" crossorigin="anonymous" src="//repo.bfw.wiki/bfwrepo/video/602efb889f941.mp4" style="display: none;"></video> <p class="text">点击页面查看惊人特效</p> <button class="btn" id="fullscr">全屏查看</button> </div> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/three.115.js"></script> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/gsap.3.5.2.js"></script> <script> let webgl = {}; let tail = {}; (function initThree() { webgl.container = document.getElementById("canvas_container"); webgl.scene = new THREE.Scene(); webgl.camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 10000); webgl.camera.position.z = 180; webgl.renderer = new THREE.WebGLRenderer({ alpha: true, antialias: true }); webgl.renderer.setSize(webgl.container.clientWidth, webgl.container.clientHeight); webgl.renderer.setPixelRatio(window.devicePixelRatio); webgl.container.appendChild(webgl.renderer.domElement); webgl.clock = new THREE.Clock(true); webgl.phase = "wall"; webgl.loader = new THREE.TextureLoader(); webgl.texture = webgl.loader.load('//repo.bfw.wiki/bfwrepo/image/5fbedf8f5349c.png?x-oss-process=image/auto-orient,1/resize,m_fill,w_450,h_150,/quality,q_90', setup); })(); function setup() { pixelExtraction(); .........完整代码请登录后点击上方下载按钮下载查看
网友评论0