• css动画属性


     css动画中的transform有4个方法,分别是translate平移、rotate旋转、scale缩放、skew斜切   

    • translate有2个参数,代表x轴和y轴, 只有1个参数时,只在x轴移动,y轴默认是0;transform: translate(10px,10px)

        -ms-transform:translate(x,y);       /*IE9*/ 
        -moz-transform:translate(x,y);     /*Firefox*/
        -webkit-transform:translate(x,y);  /*Safari和chrome*/
        -o-transform:translate(x,y);          /*Opera*/

    • rotate(1800deg)参数值为正数顺时针旋转,值为负数逆时针旋转; transform:rotate(90deg)
    • transform-origin:0 0 ; 设置旋转的中心点 ,默认是(0,0)
    • scale(x,y)  x轴和y轴缩放,第二个参数没有默认取第一个参数的值,scale(0.5)参数值小于1缩小,scale(1.5)参数值大于1放大; transform:scale(1.2)
    • skew(x,y) 斜切 用法和rotate类似,在x轴和y轴同时进行角度扭曲,第二个参数没有时默认为0,不进行斜切;
    • transition-property: none| all | property ;  all表示所有属性都有过渡效果,property定义应用过渡效果的 CSS 属性名称列表,列表以逗号分隔
    • transition-duration: time值;默认是0 没有动画效果,以秒或者毫秒计
    • transform的4个方法叠加使用时,先做偏移,在做其他
    /* 动画起始 */
    		@keyframes name{
    			from{
    				transform: translate(0,0);
    			}
    			to{transform: translate(1000px,0);}
    		}
    		div{
    			/* 使用动画名字 */
    			animation-name: name;
    			/* 动画持续时间 */
    			animation-duration: 5s;
    			/* 运动曲线 */
    			animation-timing-function: ease;
    			/* 何时开始 */
    			animation-delay: 2s;
    			/* 重复次数  infinte无限*/
    			animation-iteration-count: infinite;
    			/* 反方向播放 */
    			animation-direction: alternate;
    			/* 设置结束状态 初始值为backwards*/
    			animation-fill-mode: backwards;
    			/* 规定动画是否运行或者暂停  paused是暂停动画*/
    			animation-play-state: paused;
    		}
    

      简写:

      animation:动画名称  持续时间 运动曲线 何时开始 播放次数 是否反方向 动画起始或结束时的状态

     需要单写,配合鼠标点击移入移出方法使用animation-play-state: paused;

    代码改变了我们,也改变了世界
  • 相关阅读:
    【2018.05.05 C与C++基础】C++中的自动废料收集:概念与问题引入
    【2018.04.27 C与C++基础】关于switch-case及if-else的效率问题
    【2018.04.19 ROS机器人操作系统】机器人控制:运动规划、路径规划及轨迹规划简介之一
    March 11th, 2018 Week 11th Sunday
    March 10th, 2018 Week 10th Saturday
    March 09th, 2018 Week 10th Friday
    March 08th, 2018 Week 10th Thursday
    March 07th, 2018 Week 10th Wednesday
    ubantu之Git使用
    AMS分析 -- 启动过程
  • 原文地址:https://www.cnblogs.com/wencaiguagua/p/14332852.html
Copyright © 2020-2023  润新知