'cocos2d html5 mask 마스크'에 해당되는 글 1건

  1. 2013.10.02 [cocos2d-html5]마스크 적용하기
html52013. 10. 2. 11:40

#마스크 적용(타임 바 만들기)


@세팅

        this.bar = cc.Sprite.create(game_timebar);

        this.addChild(this.bar);

        this.bar.setAnchorPoint(cc.p(0, 0.5));

        this.barSize = this.bar.getContentSize();

  this.bar.setTextureRect(cc.RectMake(0, 0, this.barSize.width, this.barSize.height));


@업데이트 

  var barW = this.barSize.width - (경과 시간 / 전체 시간 * this.barSize.width);

        if(barW <= this.barSize.width)

        {

            this.bar.setTextureRect(cc.RectMake(0, 0, barW, this.barSize.height));

        }


*sprite 사이즈 보다 rect 가 클 경우 화면에 안 보인다.

Posted by 차돌이라네