탐색 막대 버튼에 애니메이션을 적용하려고합니다. 텍스트 (이미지)가 그대로 유지되는 동안 li 태그 배경의 이미지가 위아래로 튀어 나오게하고 싶습니다.배경 이미지 애니메이션
나는 배경 이미지에 애니메이션을 적용하는 직접적인 CSS 방법이 없다는 것을 알고 있지만이를 고려하려고 노력했습니다.
내 코드 아래의 JSFiddle 링크를 참조하십시오
#Home
{
position: absolute;
width:125px;
height:100px;
background: transparent url('Images/Icons/HomeIcon.png') no-repeat top center;
-webkit-animation-fill-mode:both;
-moz-animation-fill-mode:both;
-ms-animation-fill-mode:both;
-o-animation-fill-mode:both;
animation-fill-mode:both;
-webkit-animation-duration:1s;
-moz-animation-duration:1s;
-ms-animation-duration:1s;
-o-animation-duration:1s;
animation-duration:1s;}
.animated.hinge
{
-webkit-animation-duration:2s;
-moz-animation-duration:2s;
-ms-animation-duration:2s;
-o-animation-duration:2s;
animation-duration:2s;
}
@-webkit-keyframes bounce {
0%, 20%, 50%, 80%, 100% {-webkit-transform: translateY(0);}
40% {-webkit-transform: translateY(-30px);}
60% {-webkit-transform: translateY(-15px);}
}
@-moz-keyframes bounce {
0%, 20%, 50%, 80%, 100% {-moz-transform: translateY(0);}
40% {-moz-transform: translateY(-30px);}
60% {-moz-transform: translateY(-15px);}
}
@-o-keyframes bounce {
0%, 20%, 50%, 80%, 100% {-o-transform: translateY(0);}
40% {-o-transform: translateY(-30px);}
60% {-o-transform: translateY(-15px);}
}
@keyframes bounce {
0%, 20%, 50%, 80%, 100% {transform: translateY(0);}
40% {transform: translateY(-30px);}
60% {transform: translateY(-15px);}
}
#Home:hover {
-webkit-animation-name: bounce;
-moz-animation-name: bounce;
-o-animation-name: bounce;
animation-name: bounce;
}
애니메이션 사실
안녕하세요, 저속 회신에 사과드립니다. 주어진 코드를 구현했지만, 전체 배경 이미지를 표시하기 위해 모든 것을 시도했지만 애니메이션은 잘 살리지 만 높이 및 너비 값은 변경되지 않습니다. – WibblyWobbly
'background-size' 속성으로 놀아 보았습니까? 첫 번째 값은 너비이고 두 번째 값은 높이입니다. 백분율을 사용하면 컨테이너 크기의 백분율로 설정됩니다. 나는 당신의 질문에 조금 혼란스러워합니다. 당신이 사이즈를 움직이기 원한다고 말하는 것입니까 (크기가 커지거나 작아지기를 바랍니다), 또는 전체 시간에 단지 크기가 틀린가요? 당신이 새로운 바이올린을 만들면 그것에 대해 살펴보고 도움을 얻을 것입니다. – raphaelvalerio