Вход Регистрация
Файл: sys/javascript/sources/core/animation.js
Строк: 187
<?php
// include "core/animate.js"
// include "core/dom.js"
DCMS.Animation = {
   
    };

    
DCMS.Animation._AnimatingNodes = [];
    
DCMS.Animation._AnimatingProperties = [];
    
DCMS.Animation._AnimatingAnimates = [];

    
DCMS.Animation.addToList = function(dompropertyanimate){
        
DCMS.Animation._AnimatingNodes.push(dom);
        
DCMS.Animation._AnimatingProperties.push(property);
        
DCMS.Animation._AnimatingAnimates.push(animate);
    };
    
    
DCMS.Animation.deleteFromlist = function(index){
        
DCMS.Animation._AnimatingNodes.splice(index1);
        
DCMS.Animation._AnimatingProperties.splice(index1);
        
DCMS.Animation._AnimatingAnimates.splice(index1);
    };
    
    
DCMS.Animation.getIndexByProp = function(domproperty){
        for (var 
DCMS.Animation._AnimatingNodes.lengthi++){            
            if (
DCMS.Animation._AnimatingNodes[i] == dom && DCMS.Animation._AnimatingProperties[i] == property)
                return 
i;
        }
        return -
1;
    };

    
DCMS.Animation.stop = function(dompropertyto_end_step){    
        var 
index DCMS.Animation.getIndexByProp(domproperty);    
        if (~
index){
            
// console.log('stop', dom, property);
            
DCMS.Animation._AnimatingAnimates[index].End(!!to_end_step);
            
DCMS.Animation.deleteFromlist(index);
        }    
    };

    
DCMS.Animation.colorStep = function(color1color2step){    
        if (!(
color1 instanceof RGBColor))
            
color1 = new RGBColor(color1);
        
        if (!(
color2 instanceof RGBColor))
            
color2 = new RGBColor(color2);
        
        var 
=  parseInt(color1.+ (color2.color1.r) * step);
        var 
=  parseInt(color1.+ (color2.color1.g) * step);
        var 
=  parseInt(color1.+ (color2.color1.b) * step);
        
        if (
color1.== 0){
            
=  color2.r;
            
=  color2.g;
            
=  color2.b;
        }
        
        if (
color2.== 0){
            
=  color1.r;
            
=  color1.g;
            
=  color1.b;
        }
        
        var 
=  parseFloat(color1.+ (color2.color1.a) * step);
        
        return new 
RGBColor('rgba(' ', ' ',' +',' +')');
    };

    
    
DCMS.Animation.style = function(dompropertyvaluedurationcallbackEnd){
        if (!
dom || !dom.style)
            return 
false;
       
        
DCMS.Animation.stop(domproperty);
    
        if (!
DCMS.isNumber(duration))
            
duration DCMS.StyleAnimationDuration;
        if (
duration && duration 30// считаем, что задано в секундах
            
duration *= 1000;
        
        
property property.toCamel();
    
        var 
styleStartstyleEnd;
        if (
DCMS.isArray(value) && value.length == 2){
            
styleStart DCMS.Dom.parseStyle(value[0] === '' DCMS.Dom.getComputedValue(domproperty) : value[0]);
            
styleEnd DCMS.Dom.parseStyle(value[1] === '' DCMS.Dom.getDefaultValue(domproperty): value[1]); 
            
value value[1];
        }else{
            
styleStart DCMS.Dom.parseStyle(DCMS.Dom.getComputedValue(domproperty));
            
styleEnd DCMS.Dom.parseStyle(value === '' DCMS.Dom.getDefaultValue(domproperty): value);            
        }
    
        if (
styleEnd.units == '%')
            
styleEnd DCMS.Dom.parseStyle(DCMS.Dom.getProbeValue(dompropertystyleEnd.value styleEnd.units));
    
        if (
styleStart.value && styleStart.units && styleEnd.units && styleStart.units != styleEnd.units)
            return 
false;
    
        var 
units =  styleEnd.units || styleStart.units;    
        
        var 
colorEnd = new RGBColor(styleEnd.value);
        var 
colorStart = new RGBColor(styleStart.value);            
    
        var 
callback = function(step){
            
//console.log(step);
            
if (colorEnd.ok){
                
dom.style[property] = DCMS.Animation.colorStep(colorStartcolorEndstep);
            
//console.log(DCMS.Animation.colorStep(colorStart, colorEnd, step));                
            
}else if (DCMS.isNumber(styleEnd.value)){
                
dom.style[property] = parseFloat(styleStart.value + (styleEnd.value styleStart.value) * step).toFixed(2) + units
            } else{
                
step 1;
            }
                        
            if (
step == 1){
                
dom.style[property] = value;
                
                
DCMS.Animation.stop(domproperty);
                if (
DCMS.isFunction(callbackEnd))
                    
callbackEnd.call(dom);
            }                            
        }
    
        if (
DCMS.StyleAnimation && duration)
            
DCMS.Animation.addToList(domproperty, new DCMS.Animate(durationcallback));
        else
            
callback(1);
    
        return 
true;
    };
?>
Онлайн: 0
Реклама