我目前正在爲一個網站做一個'動畫'背景,一小時後背景圖片滾動通過,然後重置到原來的位置重新開始。我目前通過一些photoshop欺騙手段讓圖像看起來像是一個360度的圖像。儘管在測試滾動圖像時,我注意到圖像對於每個部分的轉換都是「抽搐」的。我正在尋找一些比像素「像素跳躍」更平滑但仍然非常緩慢的東西。如果通過JavaScript有更好的選擇,我很確定所有的耳朵。我可以使用更好的(平滑)過渡嗎?
以下是我目前使用我的CSS(DIV背景圖片的大小會發生變化,一旦我其實用的圖片是成品):
*{
margin:0;
padding:0;
border: 0;
line-height: 100%;
font-size: 100%;
}
#container {
position: relative;
width: 100%;
height: 100%;
background-color: black;
}
#center {
background-image:url(http://farm4.staticflickr.com/3768/11633218256_30a04f01c3_o.png);
background-size: contain;
width: 100%;
height: 100%;
position:absolute;
animation: scroll 3600s;
animation-timing-function:linear;
animation-fill-mode:forwards;
animation-iteration-count:infinite;
}
@keyframes scroll {
0% {right:0%;}
100%{right:100%;}
}
很難知道你的意思。你能在這裏簡單的自包含的例子中重現這個問題嗎? http://jsfiddle.net/ –
@AlexWayne隨着背景應該如何工作的性質以及需要複製的規模,我很難在jsfiddle.net中向您展示我的意思。但是,這裏是一個Dropbox鏈接與我的POC內容,所以你可以看到我的意思:https://www.dropbox.com/s/ll8c7ydgbbodj4f/hexcenter5.html – JSArrakis