three实现三维曲面翻滚动画效果代码

代码语言:html

所属分类:三维

代码描述:three实现三维曲面翻滚动画效果代码

代码标签: 曲面 翻滚 动画 效果

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en" >

<head>

  <meta charset="UTF-8">

  
  
<style>
canvas {
  display: block;
  width: 100%;
  height: 100vh;
  cursor: -webkit-grab;
  cursor: grab;
}
body {
  background: linear-gradient(to top right, black, wheat);
}
a {
  position: fixed;
  top: 0;
  left: 0;
  padding: 1rem;
  z-index: 1;
  color: turquoise;
}
</style>




</head>

<body >


  
      <script  type="module">
import * as THREE from '//cdn.skypack.dev/three@0.132?min'
import { OrbitControls } from '//cdn.skypack.dev/three@0.132/examples/jsm/controls/OrbitControls?min'


// ----
// photo by Signature June (https://unsplash.com/photos/iMaawezKnbE)
// ----

const url = '//repo.bfw.wiki/bfwrepo/image/6111ccb4bac88.png';

// ----
// main
// ----

const renderer = new THREE.WebGLRenderer({ alpha: true });
const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(75, 2, .1, 100);
const controls = new OrbitControls(camera, renderer.domElement);

const color = new THREE.Color('wheat');
camera.position.set(0, 0, 4);
controls.enableDamping = true;
renderer.shadowMap.enabled = true;

const light = new THREE.DirectionalLight(color, 1);
light.position.set(4, 1, 1);
light.castShadow = true;
scene.add(light);

const R = .1;
.........完整代码请登录后点击上方下载按钮下载查看

网友评论0