简体   繁体   English

mootools中的fx可选跳过

[英]optionals skipping of fx in mootools

Is there a simple way to skip all the fx, while still setting the values and calling the events. 有没有一种简单的方法可以跳过所有fx,同时仍然设置值和调用事件。

I figured out to set the fx duration options globally to 0 by doing 我想通过执行以下操作将全局fx持续时间选项设置为0

Fx.prototype.options.duration = 0

but this still doesn't solve my problem because it sill takes some minimal time which ends up in a lot of displaying errors. 但这仍然不能解决我的问题,因为它花费最少的时间,最终导致很多显示错误。

what would be nice is something like 很好的是像

Fx.ENGINE = 'on' / 'off'
Fx.SPEED_MULTIPLYER = 1 ... 10

Well after a litte hacking I've found a solution myself... 在一次小小的黑客入侵之后,我自己找到了解决方案...

$extend(Fx.Durations, { skip: 0 });
$extend(Fx.prototype.options, { skip: false, multiplier: 1 });
Fx.implement({
    step: function() {
        var time = $time();
        if ((time < this.time + (this.options.duration / this.options.multiplier)) && !this.options.skip){
            var delta = this.transition((time - this.time) / (this.options.duration / this.options.multiplier));
            this.set(this.compute(this.from, this.to, delta));
        } else {
            this.set(this.compute(this.from, this.to, 1));
            this.complete();
        }
    },
    startTimer: function(){
        if (this.timer) return false;
        this.time = $time() - this.time;
        this.step();
        this.timer = this.step.periodical(Math.round(1000 / this.options.fps), this);
        return true;
    }
});

There is now a skip options which allows you to skip the effect and a multiplier option to globally speed up / slow down the effect. 现在有一个跳过选项,允许您跳过效果,并使用一个乘法器选项来全局加快/减慢效果。

jim 吉姆

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM