저는 CSS로만 움직이는 하트 작업을하고 있습니다.
두 번 펄싱하고 잠시 휴식을 취한 다음 다시 반복합니다.
내가 지금 가지고있는 것 :
small ==> big ==> small ==> repeat animation
내가하려는 것 :
small ==> big ==> small ==> big ==> small ==> pause ==> repeat animation
어떻게하니?
내 코드 :
#button{
width:450px;
height:450px;
position:relative;
top:48px;
margin:0 auto;
text-align:center;
}
#heart img{
position:absolute;
left:0;
right:0;
margin:0 auto;
-webkit-transition: opacity 7s ease-in-out;
-moz-transition: opacity 7s ease-in-out;
-o-transition: opacity 7s ease-in-out;
transition: opacity 7s ease-in-out;}
@keyframes heartFadeInOut {
0% {
opacity:1;
}
14% {
opacity:1;
}
28% {
opacity:0;
}
42% {
opacity:0;
}
70% {
opacity:0;
}
}
#heart img.top {
animation-name: heartFadeInOut;
animation-timing-function: ease-in-out;
animation-iteration-count: infinite;
animation-duration: 1s;
animation-direction: alternate;
}
<div id="heart" >
<img class="bottom" src="https://goo.gl/nN8Haf" width="100px">
<img class="top" src="https://goo.gl/IIW1KE" width="100px">
</div>
this Fiddle 도 참조하십시오 .