cannon实现三维气球跟随鼠飘动动画交互效果

代码语言:html

所属分类:三维

代码描述:cannon实现三维气球跟随鼠飘动动画交互效果

代码标签: 气球 跟随 飘动 动画 交互 效果

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

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">

<style>
body {
  margin: 0;
  width: 100%;
  height: 100%;
}

canvas {
  display: block;
}
</style>

</head>
<body translate="no">
<canvas id="canvas"></canvas>
<p class="collection">

</p>

<script src='//repo.bfw.wiki/bfwrepo/js/cannon.min.js'></script>

<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/chroma.min.js"></script>

<script type="module">
import {
AmbientLight,
Color,
DynamicDrawUsage,
InstancedBufferAttribute,
InstancedMesh,
MathUtils,
Mesh,
MeshPhongMaterial,
Object3D,
Scene,
SphereBufferGeometry,
SpotLight,
Vector3 } from
'//repo.bfw.wiki/bfwrepo/js/module/three/build/120/three.module.js';

import useThree from '//repo.bfw.wiki/bfwrepo/js/useThree.js';

const { randFloat: rnd, randFloatSpread: rndFS } = MathUtils;

App();

function App() {
  let three, scene;
  let cannon, iMesh;

  const target = new Vector3();
  let sphere, light1, light2;

  init();


  function init() {
    three = useThree().init({
      canvas: document.getElementById('canvas'),
      camera_fov: 50,
      camera_pos: new Vector3(0, 0, 25),
      camera_ctrl: {
        enableDamping: true,
        dampingFactor: 0.05 },

      mouse_move: true,
      mouse_r.........完整代码请登录后点击上方下载按钮下载查看

网友评论0