three将平面照片变成三维球体凹凸效果
代码语言:html
所属分类:三维
代码描述:three将平面照片变成三维球体凹凸效果
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <style> canvas { width: 100%; height: 100vh; display: block; position: fixed; } body { height: 100vh; display: grid; grid-auto-flow: column; place-content: start start; } a { position: relative; padding: 5vmin; font: bold 1em/1 'MuseoModerno', cursive; text-decoration: none; color: #222; } a:hover { -webkit-transition: all 0.3s; transition: all 0.3s; background: powderblue; } </style> </head> <body translate="no"> <base target='_blank'> <script type="text/javascript" src="http://repo.bfw.wiki/bfwrepo/js/gsap.3.3.1.js"></script> <script type="module"> import * as $ from '//unpkg.com/three@0.117.1/build/three.module.js' import { OrbitControls } from '//unpkg.com/three@0.117.1/examples/jsm/controls/OrbitControls.js' // ---- // Boot // ---- const renderer = new $.WebGLRenderer({ antialias: false }); const scene = new $.Scene(); const camera = new $.PerspectiveCamera(75, 2, .1, 100); const controls = new OrbitControls(camera, renderer.domElement); window.addEventListener('resize', () => { const { clientWidth, clientHeight } = renderer.domElement; renderer.setPixelRatio(window.devicePixelRatio); renderer.setSize(clientWidth, clientHeight, false); camera.aspect = clientWidth / clientHeight; camera.updateProjectionMatrix(); }); document.body.prepend(renderer.domElement); window.dispatchEvent(new Event('resi.........完整代码请登录后点击上方下载按钮下载查看
网友评论0