Вход Регистрация
Файл: sys/javascript/sources/core/animate.js
Строк: 92
<?php
// include "core/dcms.js"

DCMS.Animate = function(durationcallbackdelta){
    
    if (
delta && DCMS.Animate.deltaFunctions[delta])
        
this.delta DCMS.Animate.deltaFunctions[delta];    
    else 
        
this.delta DCMS.Animate.deltaFunctions['life'];
          
    
    if (
typeof callback != 'function')
        throw new 
Error('callback не является функцией');
    else
        
this.callback callback;
    
    
this.duration duration || 1000;
    
this.runned true;
    
this.interval 20;
    
this.start = new Date().getTime();
    
this.Step();
};

    
DCMS.Animate.prototype.End = function(to_end){
        if (!
this.runned)
            return;
        
this.runned false;
    
        if (
to_end)
            
this.callback(1);
    }

    
DCMS.Animate.prototype.Step = function(){
        if (!
this.runned)
            return;
        
        var 
step = (new Date().getTime() - this.start)/ this.duration;
        
        if (
step >= 1)
            
step 1;
        
        
this.callback(step == :this.delta(step));        
        
        if (
step 1)
            
setTimeout(DCMS.getEventHandler(this.Stepthis), this.interval);
    };

    
DCMS.Animate.deltaFunctions = {
        
linear: function (input){
            return 
input;
        },
        
drop: function(input){
            return 
DCMS.Animate.deltaFunctions._easeOut(DCMS.Animate.deltaFunctions._bounce)(input);        
        },
        
life: function(input){
            return 
DCMS.Animate.deltaFunctions._easeOut(DCMS.Animate.deltaFunctions._quad)(input);
        },
        
_bounce: function (progress) {
            for (var 
01result1+= b/= 2) {
                if (
progress >= (a) / 11) {
                    return -
Math.pow((11 11 progress) / 42) + Math.pow(b2);
                }
            }
            return 
1;
        },
        
_easeOut: function (delta) {
            return function(
progress) {
                return 
delta(progress);
            }
        },
        
_quad: function (progress) {
            return 
Math.pow(progress4);
        }

    };
?>
Онлайн: 0
Реклама