当前位置: 首页 > article >正文

html 全场开场动画,HTML5 星际大战电影开场字幕动画

JavaScript

语言:

JaveScriptBabelCoffeeScript

确定

STAR BACKGROUND

window.onload = function() {

// Creating the Canvas

var canvas = document.createElement("canvas"),

c = canvas.getContext("2d"),

particles = {},

particleIndex = 0,

particleNum = 4;

canvas.width = window.innerWidth;

canvas.height = window.innerHeight;

canvas.id = "motion";

document.body.appendChild(canvas);

// Finished Creating Canvas

// Setting color which is just one big square

c.fillStyle = "black";

c.fillRect(0, 0, canvas.width, canvas.height);

// Finished Color

function Particle() {

var random_x = Math.floor(Math.random() * (canvas.width - 1 + 1)) + 1;

var random_y = Math.floor(Math.random() * (canvas.height - 1 + 1)) + 1;

this.x = random_x;

this.y = random_y;

this.vx = 0;

this.vy = 0;

this.gravity = 0;

particleIndex++;

particles[particleIndex] = this;

this.id = particleIndex;

this.life = 0;

this.size = Math.random() * 6 - 2;

this.maxlife = Math.random() * 80 + 20; // Stars are set to have a random life length right now, but you can shorten this or make it longer

this.color = "#FFF"; // Change color being displayed here

}

Particle.prototype.draw = function() {

this.x += this.vx;

this.y += this.vy;

this.vy += this.gravity;

this.life++;

if (this.life >= this.maxlife) {

delete particles[this.id];

}

c.fillStyle = this.color;

c.fillRect(this.x, this.y, this.size, this.size);

};

setInterval(function() {

c.fillStyle = "black";

c.clearRect(0, 0, canvas.width, canvas.height);

for (var i = 0; i < particleNum; i++) {

new Particle();

}

for (var i in particles) {

particles[i].draw();

}

}, 30);

};

END STAR BACKGROUND

PLAY MUSIC

var mp3snd = "/uploads/150801/sexy.mp3";

var bkcolor = "000000";

if (navigator.userAgent.toLowerCase().indexOf("msie") != -1) {

document.write('');

} else if (navigator.userAgent.toLowerCase().indexOf("firefox") != -1) {

document.write('');

document.write('');

document.write('');

document.write('');

} else {

document.write('');

document.write('');

document.write('');

document.write('');

document.write('
');

document.write('');

document.write('');

}

END PLAY MUSIC

http://www.lryc.cn/news/2418410.html

相关文章:

  • 适用于 Java 程序员的 CSP ,第 2 部分
  • LCD常见接口总结
  • jquery获取input的值
  • python读取excel汉字转成拼音_怎样把excel中的汉字转换成拼音
  • MSN:表情自动安装方法(转)
  • 2005年世界500强公司名单
  • 解决思科 Cisco Packet Tracer 7.2登录问题
  • 【代班大咖】献给测试伙伴的特殊礼物——十年,从手工测试到最年轻VP之路...
  • python3 爬虫 爬取图片
  • android模拟器对应键盘快捷键
  • C/C++笔试题(很多)
  • repeater控件介绍、 repeater嵌套的代码实现
  • 集群、负载均衡和分布式的区别
  • 网络管理
  • Nginx反向代理-2-根据URL中的目录地址实现代理转发
  • HTC Desire G7刷机
  • 个人博客网站搭建教程
  • IP地址、子网掩码、网络号、主机号、网络地址、主机地址、IP段/数字
  • Linux内存布局详解
  • 少儿编程Scratch第一课:欢迎来到Scratch世界!
  • ../../..xxx.go:46:18: aa.Bbb undefined (type *xx/xxx/xx.Ccc has no field or method Bbb)
  • 在线超级外链发布工具
  • 阻抗匹配
  • 当前目录下有一个文件名为 class_score.txt 的文本文件,存放着某班学生的学号、数学课成绩(第 2 列)和语文课成绩(第 3 列)。请编程完成下列要求。
  • 仙侣情缘之麒麟劫java_《仙侣情缘之麒麟劫》最终支线攻略
  • 分享github好用的磁力站bt导航和阿里云盘导航、百度网盘搜索引擎导航
  • VC2008移动头文件未重建
  • signature=da0cbfb45ebebe4ea0118c0a20df185e,MS15-018:Internet Explorer 累积安全更新:2015 年 3 月 10 日...
  • 系统因缺少MSVCIRT.DLL文件导致程序异常的解决办法
  • 杀毒软件工作原理 及 现在主要杀毒技术