问答详情
源自:1-3 眨眼睛

为什么我的小鱼眼睛只眨一下就闭着眼睛了

为什么我的小鱼眼睛只眨一下就闭着眼睛了

提问者:姑娘有点太傲娇 2016-01-13 13:35

个回答

  • 聰哥哥3847552
    2017-09-01 17:32:54

    //baby eye

    this.babyTailTimer += deltaTime;

    if(this.babyEyeTimer > this.babyEyeInterval)

    {

    this.babyEyeCount = (this.babyEyeCount + 1) % 2;

    this.babyEyeTimer %= this.babyEyeInterval;


    if(this.babyEyeCount == 1)

    {

    this.babyEyeInterval = Math.random() * 1500 + 2000;//[,)

    }else

    {

    this.babyEyeInterval = 200;

    }

    }

    还是不咋眼啊

  • 红尘叶
    2016-01-13 15:41:34

    应该是你的时间没有自循环

            this.babyEyeTimer+=deltaTime;
    	if(this.babyEyeTimer>this.babyEyeInterval){
    		this.babyEyeCount=(this.babyEyeCount+1)%2;
    		this.babyEyeTimer%=this.babyEyeInterval;    //时间重置
    
    		if(this.babyEyeCount==0){	//闭眼,要睁开眼睛
    			this.babyEyeInterval=Math.random()*1500+2000;
    		}else{
    			this.babyEyeInterval=200;	//睁开眼,要闭眼,眨眼
    		}
    	}
    	var babyEyeCount=this.babyEyeCount;