three打造3d三维宇宙星际效果
代码语言:html
所属分类:三维
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <style> a { position: absolute; text-decoration: none; color: white; font-weight: 100; left: 50px; bottom: -20px; transition: 0.3s; } a:hover { font-weight: 300; } body { color: #000; font-family: Raleway; font-weight: 100; font-size: 15px; font-weight: bold; height: 100%; width: 100%; margin: 0; overflow: hidden; } #content { position: absolute; } body #container img { position: absolute; left: 50px; z-index: 2; width: 2px; height: 0px; top: 50%; margin-top: -100px; } body #container #welcome { opacity: 0; width: 900px; padding-left: 20px; color: white; font-size: 18pt; position: absolute; top: 50%; margin-top: -35px; left: 50px; } body #container #welcome #lastSentence { font-family: 'Raleway'; margin: 0; font-weight: 400; font-size: 14pt; } body #container #welcome #firstSentence { font-weight: 500; font-size: 22pt; margin: 0; margin-bottom: 8px; margin-top: 2px; } body #container #welcome #universe { text-transform: uppercase; font-family: 'Raleway'; font-weight: 800; } body #container #content { top: 50%; margin-top: -70px; width: 500px; left: 70px; } body #container #content h2 { margin: 0; } body #container #content span { font-family: Raleway; font-weight: 600; } body #container #content #contentTitle { font-family: Raleway; color: white; opacity: 1; font-weight: 200; letter-spacing: 1.5px; font-size: 26pt; } body #container #content #contentTitle span { color: #F66120; } body #container #content #contentTitle div { font-size: 12pt; display: inline-block; } body #container #content #subtitle { letter-spacing: 1.5px; margin: 0; font-size: 16pt; font-family: Raleway; font-weight: 200; color: white; } body #container #content #description { color: white; letter-spacing: 1.5px; font-family: Raleway; font-weight: 200; font-size: 16pt; } body #container #content #description span { color: #F66120; } body #container #content #description div { color: #acacac; font-size: 10pt; } body #container #content #description a { color: white; line-height: 10px; transition: 0.3s; } body #container #content #description a:hover { line-height: 11px; font-weight: 500; } </style> </head> <body translate="no"> <style> @import url('https://fonts.googleapis.com/css?family=Raleway:100,100i,200,300,400,500,600,700,800'); </style> <div id="container"> <img id="border" src="https://image.ibb.co/gFxj6F/border.png"> <div id="welcome"> <p id="firstSentence">Welcome to my <span id="universe">universe</span></p> <p id="lastSentence">Click on the <span id="sun">sun</span> to get started</p> </div> <div id="content"> <h2 id="contentTitle"></h2> <p id="subtitle"></p> <p id="description"></p> </div> <div><a id="social" target="_blank" href="https://twitter.com/nskargovskii">follow : @nskargovskii</a></div> </div> <script type="text/javascript" src="http://repo.bfw.wiki/bfwrepo/js/jquery-3.2.1.min.js"></script> <script src='http://repo.bfw.wiki/bfwrepo/js/TweenMax.min.js'></script> <script type="text/javascript" src="http://repo.bfw.wiki/bfwrepo/js/three.js"></script> <script type="text/javascript" src="http://repo.bfw.wiki/bfwrepo/js/stats-min.js"></script> <script src='http://repo.bfw.wiki/bfwrepo/js/OrbitControls.js'></script> <script > var container, stats; var camera, controls, scene, renderer; var info; var cube; var sphereTab = []; var objects = []; var parent2; var sun; var sun2; var sun3; var currentcolor; var cubeNul; var earthPivot; var earthPivot3; var mesh; var planetViewed = 0; init(); animate(); $(window).on('load', function () { TweenMax.to($('#welcome'), 1, { css: { opacity: 1 }, ease: Quad.easeInOut }); TweenMax.to($('#social'), 0.5, { css: { bottom: '20px' }, delay: 0.5, ease: Quad.easeInOut }); TweenMax.to($('#border'), 0.5, { css: { height: '200px' }, delay: 0.5, ease: Quad.easeInOut }); }); function hideWelcome() { TweenMax.to($('#welcome'), 0.5, { css: { opacity: 0 }, ease: Quad.easeInOut }); TweenMax.to($('#welcome'), 0.5, { css: { display: 'none' }, delay: 1, ease: Quad.easeInOut }); } function init() { camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 1, 1000); camera.position.z = 68; controls = new THREE.OrbitControls(camera); controls.maxDistance = 300; controls.minDistance = 30; scene = new THREE.Scene(); var geoSphere = new THREE.Spher.........完整代码请登录后点击上方下载按钮下载查看
网友评论0