| 123456789101112131415161718192021222324252627282930313233343536373839 |
- const { ccclass, property } = cc._decorator;
- /**
- * 世界公告 滚动播放
- * @author 邹勇
- */
- @ccclass
- export default class TweenCast extends cc.Component {
- @property({ type: cc.RichText, displayName: "公告内容" })
- private rich_text: cc.RichText = null;
- @property({ displayName: "显示时间" })
- private display_time: number = 5;
- @property({ displayName: "进出速度" })
- private move_speed: number = 2;
- @property({ displayName: "等待时间" })
- private wait_time: number = 10;
- onLoad() {
- this.reset();
- }
- start() {
- cc.tween(this.node)
- .delay(3)
- .call(() => {
- this.node.active = true;
- }, this)
- .to(3, { x: 100 })
- .delay(5)
- .to(3, { x: -100 })
- .call(this.reset.bind(this))
- .union().repeatForever().start();
- }
- private reset() {
- this.node.active = false;
- this.rich_text.node.x = 250;
- }
- }
|