首页 > Web开发 > 详细

css3实现循环抖动等动画

时间:2020-05-16 20:59:24      阅读:67      评论:0      收藏:0      [点我收藏+]
技术分享图片
<!doctype html>
<html charset="utf-8">
<head>
<link rel="dns-prefetch" href="http://i.tq121.com.cn">
<meta charset="utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>重点在实现抖动</title>
<meta http-equiv="Content-Language" content="zh-cn">

<meta name="keywords" content="关键词,关键词,..." />
<meta name="description" content="关键词,关键词,..." />
<style type="text/css">
/* 实现图片旋转,当鼠标移动上去就停止 */

/* 实现的是过渡 */
img:hover{
width:1000px;
/* 开始之前等待两秒,实现过渡 */
transition: width 10s linear 0s; 
/* Firefox 4 */
-moz-transition:width 10s linear 0s;
/* Safari and Chrome */
-webkit-transition:width 10s linear 0s;
/* Opera */
-o-transition:width 10s linear 0s;

/* 实现角度变化*/
transform: rotate(5deg);
-webkit-transform: rotate(5deg);    /* Safari 和 Chrome */
-moz-transform: rotate(5deg);
}

/* 实现抖动 */
@keyframes myfirst
{
 0% {
        transform: scale(1);
        transform: scale(1)
    }

    70%,73%{
        transform: scale(0.9) rotate(-3deg);
        transform: scale(0.9) rotate(-3deg)
    }

    77%,83%,90%,97%  {
        transform: scale(1.1) rotate(3deg);
        transform: scale(1.1) rotate(3deg)
    }

    80%,87%,93%{
        transform: scale(1.1) rotate(-3deg);
        transform: scale(1.1) rotate(-3deg)
    }

    100% {
        transform: scale(1) rotate(0);
        transform: scale(1) rotate(0)
    }
}

@-moz-keyframes myfirst /* Firefox */
{
 0% {
        transform: scale(1);
        transform: scale(1)
    }

    70%,73%{
        transform: scale(0.9) rotate(-3deg);
        transform: scale(0.9) rotate(-3deg)
    }

    77%,83%,90%,97%  {
        transform: scale(1.1) rotate(3deg);
        transform: scale(1.1) rotate(3deg)
    }

    80%,87%,93%{
        transform: scale(1.1) rotate(-3deg);
        transform: scale(1.1) rotate(-3deg)
    }

    100% {
        transform: scale(1) rotate(0);
        transform: scale(1) rotate(0)
    }
}

@-webkit-keyframes myfirst /* Safari 和 Chrome */
{
 0% {
        transform: scale(1);
        transform: scale(1)
    }

    70%,73%{
        transform: scale(0.9) rotate(-3deg);
        transform: scale(0.9) rotate(-3deg)
    }

    77%,83%,90%,97%  {
        transform: scale(1.1) rotate(3deg);
        transform: scale(1.1) rotate(3deg)
    }

    80%,87%,93%{
        transform: scale(1.1) rotate(-3deg);
        transform: scale(1.1) rotate(-3deg)
    }

    100% {
        transform: scale(1) rotate(0);
        transform: scale(1) rotate(0)
    }
}

@-o-keyframes myfirst /* Opera */
{
 0% {
        transform: scale(1);
        transform: scale(1)
    }

    70%,73%{
        transform: scale(0.9) rotate(-3deg);
        transform: scale(0.9) rotate(-3deg)
    }

    77%,83%,90%,97%  {
        transform: scale(1.1) rotate(3deg);
        transform: scale(1.1) rotate(3deg)
    }

    80%,87%,93%{
        transform: scale(1.1) rotate(-3deg);
        transform: scale(1.1) rotate(-3deg)
    }

    100% {
        transform: scale(1) rotate(0);
        transform: scale(1) rotate(0)
    }
}
/* 实现捆绑 myfirst*/
img
{
-webkit-animation: myfirst 3s both infinite;
-moz-animation: myfirst 3s both infinite;
-ms-animation: myfirst 3s both infinite;
animation: myfirst 3s both infinite;
}
</style>
</head>
<body>
<img width="50" height="300" src="C:\Users\macbook\Desktop\1.jpg"/>




</body>
</html>
View Code

 

css3实现循环抖动等动画

原文:https://www.cnblogs.com/ciscolee/p/12902079.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!