ProgressTimer滚动条知识点

1.ProgressTimer
var to = cc.progressTo(2, 100);       //进度条向右的进度动画
        var left = new cc.ProgressTimer(new cc.Sprite(s_pathSister1)); //new 一个ProgressTimer对象
        jindutiao.type = cc.ProgressTimer.TYPE_BAR;
        //    Setup for a bar starting from the left since the midpoint is 0 for the x
        jindutiao.midPoint = cc.p(0, 0);
        //    Setup for a horizontal bar since the bar change rate is 0 for y meaning no vertical change
        jindutiao.barChangeRate = cc.p(1, 0);
        this.addChild(jindutiao);
        jindutiao.x = 200;
        jindutiao.y = winSize.height / 2;
        jindutiao.runAction(to);
2.ProgressTimer API
        getType()
        获取进度条的类型
        getPercentage()
        获取进度条的百分比(0-100)
        getSprite()
        获取用来显示进度条比例的Sprite对象
        setPercentage()
        设置进度条显示的百分比
        setSprite()
        设置进度条使用的 Sprite 对象
        setType()
        设置进度条的类型
3.
var to1 = cc.sequence(cc.progressTo(2, 100), cc.progressTo(0, 0));
        var to2 = cc.sequence(cc.progressTo(2, 100), cc.progressTo(0, 0));
        var sp = new cc.Sprite("res/kaishi_2.png");
        var left = new cc.ProgressTimer(sp);
        left.type = cc.ProgressTimer.TYPE_BAR;
        //left.setReverseDirection(true);
        //left.setReverseProgress(true);
        left.midPoint = cc.p(0.5,0.5);
        //left.barChangeRate = cc.p(1, 1);
        this.addChild(left);
        left.setAnchorPoint(1,0);
        left.setPosition(cc.winSize.width>>1,cc.winSize.height>>1);
        left.scale = 0.5;
        left.runAction(to2.repeatForever());

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值