弹幕源码
来源:互联网 发布:中华姓氏家谱软件 编辑:程序博客网 时间:2024/04/30 07:15
<!DOCTYPE html>
<html>
<head>
<title>javascript弹幕</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style>
#play{
width:600px;
height:500px;
background-color:#000;
}
#tangmu{
width:600px;
height:500px;
background-color:#fff;
z-index:9999;
/* background-color: rgba(000, 1, 000, 0.1); */
background-color: blue;
}
#textStyle{
position:absolute;
font-size:24px;
color:#fff;
}
</style>
</head>
<body>
<div id="play">
<div id="tangmu"></div>
</div>
<input type="text" id="text" value="aa" />
<input type="button" value="发送" onClick="tangmu();"/>
<script>
var si;
function tangmu(){
clearInterval(si);
var text = document.getElementById("text");
var tangmu = document.getElementById("tangmu");
var textStyle="<font id=\"textStyle\">"+text.value+"</font>";
mathHeight = Math.round(Math.random()*tangmu.offsetHeight)+"px";
var textLeft=tangmu.offsetWidth+"px";
tangmu.innerHTML=textStyle;
var textStyleObj = document.getElementById("textStyle");
textStyleObj.style.left=textLeft;
textStyleObj.style.top=mathHeight;
var x=parseInt(textStyleObj.style.left);
si = setInterval("xunhuan("+x+")",100);
}
function xunhuan(left){
var textStyleObj = document.getElementById("textStyle");
textStyleObj.style.left=left;
var x=parseInt(textStyleObj.style.left);
if(x<textStyleObj.style.width){
document.getElementById("tangmu").innerHTML="";
clearInterval(si);
}else{
x-=18;
}
textStyleObj.style.left=x+"px";
}
</script>
</body>
</html>
<html>
<head>
<title>javascript弹幕</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style>
#play{
width:600px;
height:500px;
background-color:#000;
}
#tangmu{
width:600px;
height:500px;
background-color:#fff;
z-index:9999;
/* background-color: rgba(000, 1, 000, 0.1); */
background-color: blue;
}
#textStyle{
position:absolute;
font-size:24px;
color:#fff;
}
</style>
</head>
<body>
<div id="play">
<div id="tangmu"></div>
</div>
<input type="text" id="text" value="aa" />
<input type="button" value="发送" onClick="tangmu();"/>
<script>
var si;
function tangmu(){
clearInterval(si);
var text = document.getElementById("text");
var tangmu = document.getElementById("tangmu");
var textStyle="<font id=\"textStyle\">"+text.value+"</font>";
mathHeight = Math.round(Math.random()*tangmu.offsetHeight)+"px";
var textLeft=tangmu.offsetWidth+"px";
tangmu.innerHTML=textStyle;
var textStyleObj = document.getElementById("textStyle");
textStyleObj.style.left=textLeft;
textStyleObj.style.top=mathHeight;
var x=parseInt(textStyleObj.style.left);
si = setInterval("xunhuan("+x+")",100);
}
function xunhuan(left){
var textStyleObj = document.getElementById("textStyle");
textStyleObj.style.left=left;
var x=parseInt(textStyleObj.style.left);
if(x<textStyleObj.style.width){
document.getElementById("tangmu").innerHTML="";
clearInterval(si);
}else{
x-=18;
}
textStyleObj.style.left=x+"px";
}
</script>
</body>
</html>
阅读全文
0 0
- 弹幕源码
- 弹幕
- 弹幕
- 弹幕
- 弹幕
- Android开发周报:弹幕源码开放送
- iOS弹幕(源码)实现原理解析
- Android开源弹幕引擎DanmakuFlameMaster源码解析
- 视频弹幕源码、提取颜色源码、音乐播放器源码等
- 微信小程序源码大集005----微信小程序开发之视频播放器带弹幕Video弹幕颜色自定义(有图有源码)
- 弹幕效果
- js弹幕
- 弹幕实现
- 弹幕技术
- 弹幕实现
- android弹幕
- 视频弹幕
- iOS弹幕
- Hibernate简介
- SDUT-3343 数据结构实验之二叉树四:(先序中序)还原二叉树
- 牛客网在线编程——链表中环的入口节点(Java)
- Class.forName()用法详解
- BZOJ1083 繁忙的都市(最小生成树,Kruskal)
- 弹幕源码
- 对于表示学习概念的理解
- org.hibernate.StaleStateException: Batch update returned unexpected row count from update: 0 actual
- UVA 10954 STL优先队列 模拟Huffmancode
- 关于Date操作的方法大全(50个)
- java.lang.NoClassDefFoundError: javax/el/ELResolver解决方案
- 忘记 CleanMyMac激活码 怎么办? 找回激活码
- Data Augmentation & data Transfer Learning
- 题目1167:数组排序