前端 动画

css3过渡动画

border-radius 设置元素变成圆角
transition 设置动画 4个属性
ease 慢速 加速 慢速 停止的过渡效果
ease-in 慢速 快速 ease-out 快开始越来

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>css3过渡动画</title>
    <style type="text/css">
        .box1{
            width: 100px;
            height: 100px;
            background-color: gold;
            /*transition: width 500ms ease,height 300ms ease 500ms,background-color 500ms ease 1s,border-radius 500ms ease 1.5s;*/
            /*单个执行*/
            transition: all 500ms ease;
        }
            /*所有一起执行*/
        .box1:hover{
            width: 500px;
            height: 300px;
            background-color: red;
            border-radius: 50px; 
        }
        /* border-radius 设置元素变成圆角
            transition 设置动画 4个属性
            ease 慢速 加速 慢速 停止的过渡效果
            ease-in 慢速 快速  ease-out 快开始越来
        */

    </style>
</head>
<body>
    <div class="box1">
        <!-- <div class="box2"></div> -->
    </div>
</body>
</html>

transfrom变形

有四种方式 : 位移 旋转 缩放 斜切

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>transform变形</title>
    <!-- 四种方式 位移 旋转  缩放 斜切-->
    <style type="text/css">
        .box{
            width: 200px;
            height: 200px;
            background-color: gold;
            margin: 50px auto 0px;
            /*translate 写法transfrom:translate(x轴px,y轴px)*/
            transform: translate(50px,50px);
            
        }
        .box1{
            width: 200px;
            height: 200px;
            background-color: gold;
            margin:50px auto 0px;
            /*scale 缩放 写法transfrom:scale(x轴,y轴)*/
            transform: scale(0.5,0.2);
        }
        .box2{
            width: 200px;
            height: 200px;
            background-color: gold;
            margin:50px auto 0px;
            /*rotate 旋转 写法transfrom:rotate(  deg)*/
            transform: rotate(360deg);;
        }
        .box3{
            width: 200px;
            height: 200px;
            background-color: gold;
            margin:50px auto 0px;
            /*skew 斜切 写法 transform:skew(x轴deg,y轴deg)*/
            transform: skew(0deg,45deg);
        }
    </style>
</head>
<body>
    <div class="box"></div>
    <div class="box1"></div>
    <div class="box2"></div>
    <div class="box3"></div>
</body>
</html>
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 选择qi:是表达式 标签选择器 类选择器 属性选择器 继承属性: color,font,text-align,li...
    love2013阅读 6,844评论 0 11
  • 选择qi:是表达式 标签选择器 类选择器 属性选择器 继承属性: color,font,text-align,li...
    wzhiq896阅读 5,834评论 0 2
  • 转载请声明 原文链接 关注公众号获取更多资讯 这篇文章主要总结H5的一些新增的功能以及一些基础归纳,这里只是一个提...
    前端进阶之旅阅读 12,958评论 22 225
  • CSS3新增的功能有:过渡和动画,阴影和圆角 css3过渡动画: css3都有哪些新增的东西 : 过度,动画,阴影...
    dream_seeker阅读 1,599评论 0 0
  • 1、属性选择器:id选择器 # 通过id 来选择类名选择器 . 通过类名来选择属性选择器 ...
    Yuann阅读 5,566评论 0 7