最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - What webkit animations are available in Zepto.js - Stack Overflow

programmeradmin0浏览0评论

I'm investigating Zepto.js for a mobile project but not finding much documentation on the .anim action. I know it is webkit specific but which parts of the webkit animation css does it work with? For example, 3d transforms?

I'm investigating Zepto.js for a mobile project but not finding much documentation on the .anim action. I know it is webkit specific but which parts of the webkit animation css does it work with? For example, 3d transforms?

Share Improve this question asked Nov 19, 2010 at 10:44 handloomweaverhandloomweaver 5,0217 gold badges30 silver badges33 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 6

From the source you can see, that it uses -webkit-transform internally, so everything that is available with it can be used.

translate3d

$('div').anim({ translate3d: '10px, 20px, 30px'}, 2, 'ease-out');

Zepto.Fx

(function($){
  $.fn.anim = function(props, dur, ease){
    var transforms = [], opacity, k;
    for (k in props) 
        k === 'opacity' ? opacity=props[k] : transforms.push(k+'('+props[k]+')');
    return this.css({ '-webkit-transition': 'all '+(dur||0.5)+'s '+(ease||''),
      '-webkit-transform': transforms.join(' '), opacity: opacity });
  }
})(Zepto);

Zepto also supports the following CSS transform properties:

  • translate(X|Y|Z|3d)
  • rotate(X|Y|Z|3d)
  • scale(X|Y|Z)
  • matrix(3d)
  • perspective
  • skew(X|Y)

(http://zeptojs./#animate)

They seem to be prefixed like this:

vendors = { Webkit: 'webkit', Moz: '', O: 'o', ms: 'MS' },
发布评论

评论列表(0)

  1. 暂无评论