three实现文字碎片化粒子化漩涡消散出现动画效果代码

代码语言:html

所属分类:动画

代码描述:three实现文字碎片化粒子化漩涡消散出现动画效果代码,结合了bas、TextGeometry、FontUtils、pnltri、TweenMax等插件一起实现,点击拖动可看到效果。

代码标签: three 文字 碎片化 粒子化 漩涡 消散 出现 动画

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

<!DOCTYPE html>
<html lang="en" >
<head>
  <meta charset="UTF-8">
<style>
    body {
	margin: 0;
	overflow: hidden;
}

#instructions {
	position: absolute;
	color: #666;
	bottom: 0;
	padding-bottom: 6px;
	font-family: sans-serif;
	width: 100%;
	text-align: center;
	pointer-events: none;
}
</style>

</head>
<body>
<!-- partial:index.partial.html -->
<script>
	THREE.ShapeUtils.triangulateShape = (function () {
	        var pnlTriangulator = new PNLTRI.Triangulator();
	        return function triangulateShape(contour, holes) {
	            return pnlTriangulator.triangulate_polygon([contour].concat(holes));
	        };
	    })();
</script>

<div id="three-container"></div>

<div id="instructions">
	click and drag to control the animation
</div>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/three.75.js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/bas.min.js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/TextGeometry.js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/FontUtils.js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/pnltri.min.js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/droid_sans_bold.typeface.js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/TweenMax.min.js"></script>
<script >
    window.onload = init;

function init() {
  var root = new THREERoot({
    createCameraControls:!true,
    antialias:true,
    fov:90
  });
  root.renderer.setClearColor(0x000000);
  root.renderer.setPixelRatio(window.devicePixelRatio || 1);
  root.camera.position.set(0, 0, 250);

  var textAnimation = createTextAnimation();
  root.scene.add(textAnimation);.........完整代码请登录后点击上方下载按钮下载查看

网友评论0