GSAP以比jQuery两个动画性能优越比较

GSAP以比jQuery两性能优越比较

1.性能

GSAP以比jQuery快将近20倍的性能稳占上风。
2.控制

jQuery对在动画控制显然只是考虑了简单的东西,一些jQuery插件虽然能有所弥补,但我觉得仍然不是GSAP的对手,GSAP面向隔膜泵对象的体系结构允许你在动画过程中暂停、恢复、反向、重新启动或跳跃,甚至调整时间轴上的慢动作或快进效果。谁占上风,你用了就知道的!
3.可补间属性

jQuery.animate(),但仅此而已,如果你想要做更多,你需要依靠大量的可有参差不齐的支持或尚未解决的bug的第三方插件。GSAP的CSSPlugin处理几乎可以让你扔掉所有这些东西。其中,GSAP有jQuery完全没有的textShadow(包括多个文本阴影)、2D变换像的旋转,将scaleX,的scaleY,X,Y,如果skewX和skewY,包括2D transformOrigin和定向旋转功能、3D变换像的rotationY的rotationX,z和视角,包括3D transformOrigin和定向旋转功能、borderRadius(而不需要定义每个角落,使用浏览器前缀)、className的允许你定义一个类名(或使用“+ =”或“ - =”添加/删除类),并具备隔膜泵发动机弄清楚哪些属性是不同的,使用任何你想要的轻松和动画持续时间的差异。

谁输谁赢,可见一斑!
4.工作流

GSAP完整的考虑了jQuery基本没考虑的:

容易地创建序列(即使是使用重叠的动画),可以控制作为一个整体;

灵活的面向对象的体系结构,允许将动画嵌套内其他动画,只要你想;

....

说多了都是眼泪啊!
5.兼容性

让IE6做rotation, scaleX, scaleY, x, y, skewX, skewY等2D变换,GSAP表示毫无压力。jQuery默然了。
6.声望

GSAP败下一局。
7.冲突管理

GSAP会自动处理,jQuery的话,你不得不小心的自己写了。
8.支持

jQuery略胜一筹。
9.可扩展性

jQuery完胜!
10.学习资源

jQuery完胜!
11.价格与授权

jQuery显圣,因为GSAP并不是完全开源的,它的开源类似于国内的开源程序那样,有点儿像伪开源:在免费/收费的项目中使用是不用付费的,但是,对于多用户的项目,你就需要商业许可证了:每年150美刀或者永久性的费用750美刀,不便宜!

Example (from woothemes docs)

    // Hook in   
    add_filter( 'woocommerce_default_address_fields' , 'custom_override_default_address_fields' );   
      
    // Our hooked in function - $address_fields is passed via the filter!   
    function custom_override_default_address_fields( $address_fields ) {   
         $address_fields['address_1']['required'] = false;   
      
         return $address_fields;   
    }  

 

3.Remove some fileds from the woocommerce billing/checkout page

    add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );   
    function custom_override_checkout_fields( $fields ) {   
    /*unset($fields['billing']['billing_first_name']);
    unset($fields['billing']['billing_last_name']);*/  
    unset($fields['billing']['billing_company']);   
    /*unset($fields['billing']['billing_address_1']);*/  
    unset($fields['billing']['billing_address_2']);   
    /*unset($fields['billing']['billing_city']);*/  
    unset($fields['billing']['billing_postcode']);   
    unset($fields['billing']['billing_country']);   
    /*unset($fields['billing']['billing_state']);*/  
    /*unset($fields['billing']['billing_phone']);*/  
    unset($fields['order']['order_comments']);   
    return $fields;   
    }  

 
4. modify the position of the fields.

    add_filter( 'woocommerce_billing_fields', 'custom_woocommerce_billing_fields' );   
      
    function custom_woocommerce_billing_fields( $fields ) {   
      
       // Over-ride a single label   http://www.jxnu.edu.cn/
       $fields['billing_first_name']['label'] = 'Your label';   
      
       // Over-ride a single required value   
       $fields['billing_first_name']['required'] = false;   
      
       // Over-ride the entire thing   
       $fields['billing_postcode']  = array(   
          'label'          => __('Postcode', 'woothemes'),   
          'placeholder'    => __('Postcode', 'woothemes'),   
          'required'       => true,   
          'class'          => array('form-row-last update_totals_on_change')   
       );   
      
       /**
        * You can over-ride -  billing_first_name, billing_last_name, billing_company, billing_address_1, billing_address_2, billing_city, billing_postcode, billing_country, billing_state, billing_email, billing_phone  
        */  
      
       return $fields;   
    }  

posted @ 2014-03-24 11:17  lanhe  阅读(956)  评论(0编辑  收藏  举报
数据中心