|
如何实现弹幕效果?getEles,在webform下正常用,在htmlayout下老是出问题。请高手优化下。
import win.ui;
import win.ui.menu;
import web.layout;
import mouse;
import web.layout.behavior.moveable;
import console;
var winform = win.form(text="";exmode="toolwindow");
//定制右键菜单
var popmenu = win.ui.popmenu(winform);
popmenu.addTable({
{"菜单项";function(id){
win.msgbox("本源码提供给aardio官方,根据aardio开源许可大家可以自由使用。", "作者:多多洛");
}};
{/*分隔线*/};
{"退出";function(id){
winform.close();
}};
});
//窗体消息处理函数
winform.wndproc = function(hwnd,message,wParam,lParam){
select( message ) {
case 0x205/*_WM_RBUTTONUP*/{
popmenu.popup()
}
}
}
winform.fullscreen(true); //全屏
//创建layout窗体
wbLayout = web.layout(winform);
wbLayout.html = /**
<html><head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link type="text/css" rel="stylesheet" href="common.css" />
</head>
<body><div id ="view">
<div id="lrc_area">大学英语四级考试大纲单词表
</div>
</div>
</body>
</html>
**/
wbLayout.css = /**
#view{
background-color:#666666;width:1366px;height:300px;
}
#lrc_area {
position: relative; top: 5%%; margin:0 *; width: max-intrinsic; padding: 0 10px;
font-size: 36px; font-weight: bold; font-family: hakuyoxingshu7000;
text-align: center; color: white;
outline-color: #000; outline-style: glow;
outline-width: 2px; outline-offset: 0;
left:1366;
behavior: moveable;
}
#lrc_area:hover {
background-color:rgba(ff,ff,33,0.5);
}
**/
var str = string.load("C:\software\aardio\dict4.txt")
winform.show();
var tab = string.split(str,'\n')
var x,y,cx,cy = winform.getPos();
//歌词动态效果
var $target = wbLayout.getEle("lrc_area");
tmid = winform.setInterval(
3000,
function(hwnd,msg,id,tick){
}
)
tmid = winform.setInterval(
200/*毫秒*/,
function(hwnd,msg,id,tick){
if (tonumber($target.style.left) < -300){
$target.value = tab[math.random(1,#tab)]
$target.style.left = cx;
}
else{$target.style.left = tonumber($target.style.left) - 10;}
}
);
//for(-lright;cx;1) {
//$target.style.right= i++"%";
//win.delay(50);
//}
win.loopMessage(); |
|