laro实现三维粒子聚集成文字动画效果代码
代码语言:html
所属分类:粒子
代码描述:laro实现三维粒子聚集成文字动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!doctype html>
<html class="translated-ltr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title></title>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/jquery.1.11.min.js"></script>
<style>
html {overflow:hidden}
body {position: absolute; margin:0; padding:0;width:100%; height:100%; background: #fefbe8}
canvas {display:block}
</style>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/laro.fsm.js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/JCanvas.0.1.js"></script>
</head>
<body>
<canvas id="canvas" width="100%" height="100%"></canvas>
<img id="youtext" style="display:none" crossorigin="anonymous" src="//repo.bfw.wiki/bfwrepo/images/app/youtext.png" />
<img id="designIco" style="display:none" crossorigin="anonymous" src="//repo.bfw.wiki/bfwrepo/images/app/designIco.png" />
<img id="h5ico" style="display:none" crossorigin="anonymous" src="//repo.bfw.wiki/bfwrepo/images/app/h5ico.png" />
<img id="cs3" style="display:none" crossorigin="anonymous" src="//repo.bfw.wiki/bfwrepo/images/app/cs3.png" />
<script >
Laro.register('JxHome', function (La) {
var pkg = this;
var bugBalls;
this.initStage = function () {
var canvas = document.getElementById('canvas');
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
this.canvas = canvas;
this.stage = new CVS.$stage(canvas);
this.ctx = this.stage.ctx;
this.vpx = canvas.width/2;
this.vpy = canvas.height/2;
this.normalN = 100;
this.normalBalls = [];
this.angleX = 0.001;
this.angleY = 0.001;
this.zstep = 1;
this.zflag = 1;
}
this.range = function (a, b)
{
return Math.floor(Math.random()*(b-a) + a);
}
this.tween = function (ball, t)
{
if (!ball.end)
{
var _x = ball.xpos, _y = ball.ypos, _z = ball.zpos;
var _t = (+new Date) - ball.startAnimTime;
ball.xpos = ball.f_xpos + (ball.t_xpos - ball.f_xpos)*Math.sin(Math.PI*_t/(2*t));
ball.ypos = ball.f_ypos + (ball.t_ypos - ball.f_ypos)*Math.sin(Math.PI*_t/(2*t));
ball.zpos = ball.f_zpos + (ball.t_zpos - ball.f_zpos)*Math.sin(Math.PI*_t/(2*t));
if (_t >= t)
{
ball.end = true;
}
}
}
this.addNormalBalls = function (n)
{
var vpx = this.vpx, vpy = this.vpy, range = this.range, stage = this.stage,
_this = this;
if (n) {
this.normalN = n;
}
for (var i=0; i< this.normalN; i++) {
var ball = CVS.createPoint3D(this.stage.ctx, function () {
.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0