나는 wheel-of-fortune 타입의 애니메이션을 만들려고 노력하고있다. 전체 디자인에 대해 4 개의 div를 사용하고 있습니다 (투명 PNG 사용).position : relative 및 CPU을 과도하게 사용하지 않고 CSS3 애니메이션을 어떻게 사용할 수 있습니까?
이제는 CSS3를 사용하여 애니메이션을 만들려고했지만 문제가 발생했습니다 : # 회전 div의 조상 중 하나가 상대적 위치에있을 때마다 CPU가 70 % 이상으로 점프합니다 (Macbook Pro 2.3Ghz를 사용하고 있습니다).).
다음 예에서는 #main을 position : absolute로 설정하면 일반 페이지보다 CPU를 더 이상 사용하지 않고 정상적으로 작동합니다. 그러나 position : relative로 변경하면 CPU 사용률이 70 % 이상으로 증가합니다.
누구든지이 문제를 해결하는 방법을 알고 있습니까? 여기
(나는 단지 -webkit 특정 CSS를 썼다 가독성을 위해,하지만 원래의 소스는 모든 주요 현대적인 브라우저에 해당하는 CSS가) 내 코드의 예 :<html>
<body>
<style>
@-webkit-keyframes rotate {
from {
-webkit-transform: rotate(0deg);
}
to {
-webkit-transform: rotate(360deg);
}
}
#background {
position: absolute;
background: url("background.png");
width: 604px;
height: 604px;;
}
#bottom {
position: absolute;
background: url("wheel_bg.png");
width: 604px;
height: 604px;;
}
#top {
position: absolute;
background: url("wheel_top.png");
width: 604px;
height: 604px;;
}
#rotate
{
position: absolute;
-webkit-animation-name: rotate;
-webkit-animation-duration: 15s;
-webkit-animation-iteration-count: infinite;
-webkit-animation-timing-function: linear;
background: url("wheel_rotate.png");
width: 604px;
height: 604px;
left: 0;
}
#main {
position: relative; //here's the problem
left: 50px;
top: 50px;
}
</style>
<div id="main">
<div id="background">
</div>
<div id="rotate">
</div>
<div id="top">
</div>
<div id="bottom">
</div>
</div>
</body>
</html>