我有一個 gif 影片,我想在它周圍緩慢而流暢地進行影片處理。gif 需要與父 div 保持一致。您建議使用哪些 reactJS 庫來完成這項任務?因為我想它不能只使用 css :-(
加油,圣誕快樂
uj5u.com熱心網友回復:
您可能想看看這樣的教程:https : //css-tricks.com/bounce-element-around-viewport-in-css/
body {
margin: 0;
}
img, div {
width: 100px;
height: 100px;
}
.x {
animation: x 2.6s linear infinite alternate;
}
.y {
animation: y 0.8s linear infinite alternate;
}
@keyframes x {
100% {
transform: translateX( calc(100vw - 100px) );
}
}
@keyframes y {
100% {
transform: translateY( calc(100vh - 100px) );
}
}
<div class="x">
<img class="y" src="https://upload.wikimedia.org/wikipedia/commons/thumb/e/ef/Stack_Overflow_icon.svg/768px-Stack_Overflow_icon.svg.png" alt="codepen" />
</div>
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/391295.html
