如何讓小鳥從樹上飛回飛?它現在向前發展,我希望它轉身回來......怎麼做?如何使用css和js慢慢移動藍色twitter小鳥?
$(document).ready(function(){
$(".bird").click(function(){
$(this).addClass("birdmove");
})
});
.bird img{
width: 100px;
height: auto;
}
.bird{
position: absolute;
left: 200px;
top: 100px;
z-index: 10;
transition: transform 5s;
transition-timing-function: ease;
}
.birdmove{
transform: translateX(800px);
animation: oscillate 5s;
animation-timing-function: ease;
}
@keyframes oscillate {
10% {top: 50px;}
30% {top: 150px;}
60% {top: 100px;}
80% {top: 120px;}
100% {top: 100px;}
}
<html>
<head>
\t <title>preloader</title>
\t <meta charset="utf-8">
\t <meta name="viewport" content="width=device-width, initial-scale=1">
\t <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
\t <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
\t <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
\t <link rel="stylesheet" type="text/css" href="preloader.css">
\t <script type="text/javascript" src="preloader.js"></script>
</head>
<body>
\t
\t
\t <div class ="container">
\t \t <div class = "row">
\t \t \t <div class="col-sm-8">
\t \t \t \t <div class="bird">
\t \t \t \t \t <img src="https://upload.wikimedia.org/wikipedia/en/thumb/9/9f/Twitter_bird_logo_2012.svg/1259px-Twitter_bird_logo_2012.svg.png" height="300" width="500" >
\t \t \t \t \t
\t \t \t \t </div>
\t \t \t </div>
\t \t \t <div class="col-sm-4">
\t \t \t \t <div class="static-bird">
\t \t \t \t \t <img src="https://clipartion.com/wp-content/uploads/2015/11/love-birds-in-tree-clipart.jpeg">
\t \t </div>
\t \t \t </div>
\t \t </div>
\t </div>
\t \t \t
</body>
?而分支中的另一隻鳥將是靜態的!如何使用CSS和JavaScript對其進行動畫處理?
在此先感謝!
你可以使用CSS3和JS – MatejMecka