码迷,mamicode.com
首页 > 其他好文 > 详细

新方法写动画

时间:2014-08-17 22:40:12      阅读:287      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   color   使用   os   io   for   

现在必须用appframework.js 做各种效果,

语法是和jquery差不多的,没看到animate、slideUp这些,

貌似是有用自定义标签的属性来做的,还没有试过。

不过因为现在不用考虑浏览器兼容性,只要伺候chrome一位,这些东西用css3的transition就可以轻松搞定。

任何属性,加上transition,在改变设置过transition的属性值时就会有动画效果。

语法

transition: property duration timing-function delay

Property列表:

1、color: 通过红、绿、蓝和透明度组件变换(每个数值单独处理),如:background-color,border-color,color,outline-color等CSS属性;

2、length:真实的数字,如:word-spacing,width,vertical- align,top,right,bottom,left,padding,outline-width,margin,min-width,min- height,max-width,max-height,line-height,height,border-width,border- spacing,background-position等属性;

3、percentage:真实的数字,如:word-spacing,width,vertical- align,top,right,bottom,left,min-width,min- height,max-width,max-height,line-height,height,background-position等属性;

4、integer离散步骤(整个数字),在真实的数字空间,以及使用floor()转换为整数时发生,如:outline-offset,z-index等属性;

5、number真实的(浮点型)数值,如:zoom,opacity,font-weight等属性;

6、transform list:详情请参阅:《CSS3 Transform》。

7、rectangle:通过x、 y、 width和height(转为数值)变换,如:crop;

8、visibility:离散步骤,在0到1数字范围之内,0表示“隐藏”,1表示完全“显示”,如:visibility;

9、shadow:作用于color、x、y、和blur(模糊)属性,如:text-shadow;

10、gradient:通过每次停止时的位置和颜色进行变化。它们必须有相同的类型(放射状的或是线性的)和相同的停止数值以便执行动画,如:background-image;

11、paint server (SVG):只支持下面的情况:从gradient到gradient以及color到color,然后工作与上面类似;

12、space-separated list of above:如果列表有相同的项目数值,则列表每一项按照上面的规则进行变化,否则无变化;

13、a shorthand property:如果缩写的所有部分都可以实现动画,则会像所有单个属性变化一样变化。

例如:

.translate{
    -webkit-transition:1s ease all;
    position:absolute;
    left:-274px;
    z-index: 999;
    top:10px;
    background:#4d6ea6;
}

对于所有属性all,都加上了transition

$("#btn").on("click",function(event) {
    $("#menu-container").css("left","0");
    $("#maincontan").css("left","274px");
});

appframework写的按钮点击事件就这样。

html中比如"#menu-container"的class为.translate,点击按钮后他的left起了变化,就会做left移动的动画效果。

新方法写动画,布布扣,bubuko.com

新方法写动画

标签:style   blog   http   color   使用   os   io   for   

原文地址:http://www.cnblogs.com/haimingpro/p/3918312.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!