LOW poly-低多边形测试

by elick

HTML

<script src="https://code.jquery.com/jquery-2.2.4.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/1.19.0/TweenMax.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r78/three.min.js"></script>
<!-- This pen isn't a fan of small view heights, check it out in  fullpage view for optimal viewing	 -->
<div class="x-mark">
  <div class="container">
    <div class="left"></div>
    <div class="right"></div>
  </div>
</div>
<div class="intro-container">
  <h2 class="fancy-text">Christopher Lis</h2>
  <h1>ONE WITH AN EVERLASTING DESIRE <br> FOR THE UNKNOWN & UNTOLD</h1>

  <div class="button shift-camera-button">
    <div class="border">
      <div class="left-plane"></div>
      <div class="right-plane"></div>
    </div>
    <div class="text">To The Stars</div>
  </div>
</div>
<div class="sky-container">
  <div class="text-right sky-container__left">
    <h2 class="portfolio">
				PORTFOLIO
			</h2>
    <h2 class="resurrection">
				resurrection	
			</h2>
  </div>
  <div class="text-left sky-container__right">
    <h2 class="08">
				08
			</h2>
    <h2 class="thirty-one">
				31
			</h2>
    <h2 class="2016">
				2016
			</h2>
  </div>
</div>

CSS

body {
  position: relative;
  margin: 0;
  overflow: hidden;
}

.intro-container {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: white;
  text-align: center;
  margin: 0 auto;
  right: 0;
  left: 0;
}

h1 {
  font-family: 'Brandon Grotesque', sans-serif;
  font-weight: bold;
  margin-top: 0px;
  margin-bottom: 0;
  font-size: 20px;
}

@media screen and (min-width: 860px) {
  h1 {
    font-size: 40px;
    line-height: 52px;
  }
}

.fancy-text {
  font-family: "adobe-garamond-pro", sans-serif;
  font-style: italic;
  letter-spacing: 1px;
  margin-bottom: 17px;
}

.button {
  position: relative;
  cursor: pointer;
  display: inline-block;
  font-family: 'Brandon Grotesque', sans-serif;
  text-transform: uppercase;
  min-width: 200px;
  margin-top: 30px;
}

.button:hover .border {
  box-shadow: 0px 0px 10px 0px white;
}

.button:hover .border .left-plane,
.button:hover .border .right-plane {
  transform: translateX(0%);
}

.button:hover .text {
  color: #121212;
}

.button .border {
  border: 1px solid white;
  transform: skewX(-20deg);
  height: 32px;
  border-radius: 3px;
  overflow: hidden;
  position: relative;
  transition: .10s ease-out;
}

.button .border .left-plane,
.button .border .right-plane {
  position: absolute;
  background: white;
  height: 32px;
  width: 100px;
  transition: .15s ease-out;
}

.button .border .left-plane {
  left: 0;
  transform: translateX(-100%);
}

.button .border .right-plane {
  right: 0;
  transform: translateX(100%);
}

.button .text {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  transition: .15s ease-out;
}

.x-mark {
  right: 10px;
  top: 10px;
  position: absolute;
  cursor: pointer;
  opacity: 0;
}

.x-mark:hover .right {
  transform: rotate(-45deg) scaleY(1.2);
}

.x-mark:hover .left {
  transform: rotate(45deg) scaleY(1.2);
}

.x-mark .container {
  position: relative;
  width: 20px;
  height: 20px;
}

.x-mark .left,
.x-mark .right {
  width: 2px;
...

JavaScript

"use strict";
/* globals THREE, $, TweenLite, Power3, TimelineMax  */

var camera = undefined,
  scene = undefined,
  renderer = undefined;
var plane = undefined;
var raycaster = new THREE.Raycaster();
var normalizedMouse = {
  x: 0,
  y: -180
};

// let lightBlue = {
// 	r: 34,
// 	g: 183,
// 	b: 236
// };

var darkBlue = {
  r: 0,
  g: 52,
  b: 74
};

var baseColorRGB = darkBlue;
var baseColor = "rgb(" + baseColorRGB.r + "," + baseColorRGB.g + "," + baseColorRGB.b + ")";
var nearStars = undefined,
  farStars = undefined,
  farthestStars = undefined;

function init() {
  scene = new THREE.Scene();
  // 远景相机(PerspectiveCamera) 第一个参数 相机视锥体垂直视角,从下到上的观察角度。但好像跟观察事物大小也有关
  // 最后两个是构成可视范围的近远值 超过这两个范围的 都不会渲染出来 也就是不会显示
  camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight,0.1, 1000);	
  renderer = new THREE.WebGLRenderer(); // Canvas渲染器(CanvasRenderer) 

  // Scene initialization
  camera.position.z = 50;	//镜头Z轴高度

  renderer.setClearColor("#121212", 1.0);	//这个颜色看不出有啥用
  renderer.setSize(window.innerWidth, window.innerHeight);
  renderer.setPixelRatio(window.devicePixelRatio);  //屏幕分辨率

  document.body.appendChild(renderer.domElement);

  // Lights	//灯光  因为是立体模型 所有上下两个灯光 显得透亮些
  var topLight = new THREE.DirectionalLight(0xffffff, 1);
  topLight.position.set(0, 1, 1).normalize();
  scene.add(topLight);

  var bottomLight = new THREE.DirectionalLight(0xffffff, 0.4);
  bottomLight.position.set(1, -1, 1).normalize();
  scene.add(bottomLight);
	
  //天空的灯光 真是没看出有什么用
  var skyLightRight = new THREE.DirectionalLight(0x666666, 0.2);
  skyLightRight.position.set(-1, -1, 0.2).normalize();
  scene.add(skyLightRight);

  var skyLightCenter = new THREE.DirectionalLight(0x666666, 0.2);
  skyLightCenter.position.set(-0, -1, 0.2).normalize();
  scene.add(skyLightCenter);

  var skyLightLeft = new THREE.DirectionalLight(0x666666, 0.2);
  skyLightLeft.position.set(1, -1, 0.2).normalize();
  scene.add(skyLightLeft);
  

  // Mesh creation
  var geometry = new...