动画transform,transiton,animation

2D动画:
transform:translate(100px,100px); //移动,也可transform:translateY(100px);
transform:scale(0.6); //缩放,缩放成原来的60%,也可以给2个值,分别是长和宽
transform:rotate(180deg); //旋转
transform:skew(30deg ,40deg) //倾斜
transform-origin:left top; //改变动画的基准点,默认是正中,left top是左上,0 0也是左上,也可以30px 0,也可以30% 0


3D动画:(尽量加4前缀)
perspective(1000px); //3d必须定义这个,而且是给父元素定义
transform-origin:left top; //改变动画的基准点
transform:translate3d(0,0,-300px); //移动
transform:rotate3d(1,0,0,45deg); //旋转,1,0,0是沿X轴,0,1,0是沿Y轴


css3 transiton 过渡 //不是写在hover里,写在原div
//http://www.hangge.com/blog/cache/detail_988.html //讲解很详细
//http://cubic-bezier.com/#.3,.93,.14,.99 //自定义速度工具
transition:all 1s linear 1s; //属性,过渡时间,速度变化,延迟
transition:width 1s linear, //写法2
           height 1s ease-in-out 1s;


重要重要重要-----------transition动画结束后元素的属性有变化,animation动画结束后元素的属性没有变化-----------------


css3 关键帧动画(动画结束之后元素的属性没有变化)
div{
animation-name:zidingyi; //下面动画的名字
animation-duration:2s; //完成动画的时间
animation-timing-function:ease; //完成动画的速度
animation-delay:1s; //延时
animation-iteration-count:3; //动画次数,infinite是循环
animation-direction:alternate; //动画是否逆向播放,动画次数是2才能看到
(不能简写)animation-play-state:paused; //paused会暂停,running是运行,要结合JS来写
(不能简写,兼容不好)animation-fill-mode:forwards; //forwards完成后停在最后一针,backwards在延迟时就停在第一针,both会同时应用前面两种


简写:animation:zidingyi 2S ease 1s 2 alternate;
}
写法1:
@keyfromes zidingyi{
form{
//变化前的效果
}
to{
//变化后的效果
}
}


写法2:(更常用,要写前缀,少o)
@keyfromes zidingyi{
0%{
//变化前的效果
}
50%{
//变化50%的效果
}
100%{
//变化后的效果
}
}
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值