上節(jié)點(diǎn)圖
g_bg是公告的背景圖 mask 為遮罩組件節(jié)點(diǎn) ?gundongzi為label組件節(jié)點(diǎn)
運(yùn)行效果
實(shí)現(xiàn)步驟、
1建立一個(gè)js組件 綁定 上節(jié)點(diǎn)中 mask gundongzi 兩個(gè)節(jié)點(diǎn)
具體實(shí)現(xiàn)代碼
//滾動(dòng)公告字幕
gundongText:function(){
var self = this;
setTimeout(function(){
var notifyRes = JSON.parse(cc.sys.localStorage.getItem('notify'));
var gundongNode = cc.find("Canvas/gundong");
if(notifyRes != null){
if(gundongNode){
gundongNode.active = true;
}
self.Gundong.string = notifyRes;
}else{
if(gundongNode){
gundongNode.active = false;
}
}
var text = self.Gundong;
var width = self.Zhezhao.node.width;
text.node.runAction(cc.repeatForever(cc.sequence(
cc.moveTo(text.node.width/width*10,cc.p(-text.node.width-width/5,text.node.y)),
cc.callFunc(function(){
text.node.x = width;
}))));
},300);
},