如何使用createjs

时间:2015-10-20 14:06:56

标签: javascript html5-canvas createjs tween tween.js

我有一个作为计时器旋转的钟针。如果用户在时间用完之前完成了活动,我需要停止补间。

我尝试删除补间没有运气。我做错了什么?

我进入了levelup函数,但删除补间功能不起作用。

 function Clock() {
            //    this.board = board;
            clockContainer = new createjs.Container();
            contain = new createjs.Container();
            var clockBack = new createjs.Bitmap(queue.getResult("clockBack"));
            clockHand = new createjs.Bitmap(queue.getResult("clockHand"));
            clockBack.x = 40;
            clockBack.y = 480;
            clockHand.x = 95;
            clockHand.y = 539;
            clockHand.regX = 20
            clockHand.regY = 105;
            clockHand.scaleX = clockHand.scaleY = 0.50;
            clockBack.scaleX = clockBack.scaleY = 0.50;
            clockContainer.addChild(clockBack, clockHand);
            TimerLength = 30000;
            stage.addChild(clockContainer)
            mytweentodisable = createjs.Tween.get(clockHand, { loop: false }).to({ rotation: 360 }, TimerLength).call(function () {
                //this will trigger the timer is up
                GamehasEnded = true;
                checkWrongAndRight();
            });
        }

  function levelUp() {

            createjs.Tween.removeTweens(mytweentodisable)
            console.log("adding Level up button");
            levelUpContainer = new createjs.Container();
            levelUpIcon = new createjs.Bitmap(queue.getResult("levelUp"));
            levelUpContainer.addChild(levelUpIcon);
            stage.addChild(levelUpContainer)
            levelUpContainer.x = 350
            levelUpContainer.y = 500
            levelUpContainer.addEventListener("click", function () {
                console.log("clicked it");
            });
        }

1 个答案:

答案 0 :(得分:2)

这应该可以解决问题:

interface IHEEntity { public: virtual size_t GetId() const = 0; virtual void SetId(const size_t Value) = 0; public: virtual ~IHEEntity() {}; }; class CHEEntity : public virtual IHEEntity { protected: size_t m_Id; public: size_t GetId() const final { return m_Id; } void SetId(const size_t Value) final { m_Id = Value; } public: CHEEntity() {}; virtual ~CHEEntity() {}; }; interface IHEArc : public virtual IHEEntity { public: } class CHEArc : public virtual CHEEntity, public virtual IHEArc { public: using CHEEntity::GetId; using CHEEntity::SetId; }