你的浏览器禁用了JavaScript, 请开启后刷新浏览器获得更好的体验!
输入关键字进行搜索
搜索:
没有找到相关结果
zhou_xq
赞同来自:
hj
Laya.init(500,400,Laya.WebGL);
createText();
function createText(){
this.txt = new Laya.Text();
this.txt.overflow = Laya.Text.SCROLL;
this.txt.text = "Layabox是HTML5引擎技术提供商与优秀的游戏发行商,面向AS/JS/TS开发者提供HTML5开发技术方案!\n"
;
this.txt.size(200,100);
this.txt.borderColor = "#ffff00";
this.txt.fontSize = 20;
this.txt.color = "#ffffff";
Laya.stage.addChild(this.txt);
this.txt.on(Laya.Event.MOUSE_DOWN,this,startScrollText);
}
/*开始滚动文本*/
function startScrollText(){
this.prevX = this.txt.mouseX;
this.prevY = this.txt.mouseY;
Laya.stage.on(Laya.Event.MOUSE_MOVE,this,scrollText);
Laya.stage.on(Laya.Event.MOUSE_UP,this,finishScrollText);
/* 停止滚动文本 */
function finishScrollText()
{
Laya.stage.off(Laya.Event.MOUSE_MOVE, this, this.scrollText);
Laya.stage.off(Laya.Event.MOUSE_UP, this, this.finishScrollText);
/* 鼠标滚动文本 */
function scrollText()
var nowX = this.txt.mouseX;
var nowY = this.txt.mouseY;
this.txt.scrollX += this.prevX - nowX;
this.txt.scrollY += this.prevY - nowY;
this.prevX = nowX;
this.prevY = nowY;
要回复问题请先登录
3 个回复
zhou_xq
赞同来自:
zhou_xq
赞同来自:
hj
赞同来自: