• 카테고리

    질문 & 답변
  • 세부 분야

    웹 개발

  • 해결 여부

    미해결

animation step 이 먹히지 않아요..

21.06.05 07:53 작성 조회수 138

0

안녕하세요

애니메이션 스탭이 먹히질 않는데 아무리 찾아봐도 이유를 모르겠어요..

계속 슬라이드처럼 스프라이트 이미지가 슝슝넘어갑니다. 뭐가 잘못된걸까요...

연관강의는 6강 animation3입니다.

<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.spaceship {
width: 150px;
height: 150px;
background: url('sprite_spaceship.png')no-repeat 0 0 / auto 150px;

animation: ani 1s steps(17) infinite;

/* animation: spaceship-ani 0.5s infinite steps(17); */

}

@keyframes ani {
0% {
background-position: 0 0;
}

100% {
background-position: -2250px 0;
}
}
</style>
</head>

<body>
<div class="spaceship"></div>
</body>
<script>



</script>

</html>

답변 1

답변을 작성해보세요.

0

-2250px을 -2550px로 바꾸어주세요~
끝나는 지점의 위치와 스텝 수가 딱 안떨어져서 발생한 문제입니다.
2250으로 하실 경우에는 스텝을 15로 하면 딱 맞겠네요~

감사합니다 작동확인하였습니다