Slider Animation
HTML CODE:-
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title></title> </head> <body> <div class="container"> <div class="imagebox"> <div class="image"> <img src="https://media.istockphoto.com/id/1181242983/photo/view-from-the-top-of-a-mountain-of-a-river-in-india.jpg?s=612x612&w=0&k=20&c=XzenhW33AjKkxy7_AwG7kHi9S_xfG5mmq0eNj_Tz1fU="> </div> <div class="image"> <img src="https://media.istockphoto.com/id/1151755587/photo/sunrise-behind-a-tropical-island-in-the-maldives.jpg?s=612x612&w=0&k=20&c=1P-LXAZfbvIA58uLLRU8zTiwBSnR01zDzZAChe_wM7c="> </div> <div class="image"> <img src="https://media.istockphoto.com/id/1161349666/photo/fairy-pools-glen-brittle-isle-of-skye-scotland-uk.jpg?s=612x612&w=0&k=20&c=hRtUoz_Hh7_Tt1GvliTw-DAIOhtROkahGer9veE0-uk="> </div> <div class="image"> <img src="https://media.istockphoto.com/id/1148367026/photo/tryfan-in-spring-with-the-afon-lloer-in-flow-over-the-waterfalls-wales.jpg?s=612x612&w=0&k=20&c=gaX5hyVRDeV9AeZUXZLxwqtWd8g7xjCd8ccX9xe0eiE="> </div> <div class="image"> <img src="https://media.istockphoto.com/id/1176511794/photo/aerial-view-of-morning-mist-at-tropical-rainforest-mountain-background-of-forest-and-mist.jpg?s=612x612&w=0&k=20&c=BcLm9E6PcZ6vmE3Thc2vSO1rTsYCAHYEwcF-mKArda8="> </div> <div class="image"> <img src="https://media.istockphoto.com/id/1130739032/photo/areuse-river-in-the-neuch%C3%A2tel-jura-switzerland-panorama.jpg?s=612x612&w=0&k=20&c=zqxvpzPI04Py_cS2a7BjJSP0RVSgclZne4RrHOZfPzU="> </div> </div> </div> </body> </html> |
CSS CODE:-
body{ padding: 0px; margin: 0px; min-height: 100vh; background-color: black; display: flex; } .container{ width: 250px; height: 150px; margin: auto; perspective: 1000px; } .imagebox{ width: 100%; height: 100%; position: relative; transform-style: preserve-3d; animation: animate 5s linear infinite; } @keyframes animate{ from{ transform: translateZ(-230px) rotateY(0deg); } to{ transform: translateZ(-230px) rotateY(-60deg); } } .image{ width: 250px; height: 150px; position: absolute; border: 3px solid wheat; } .image img{ width: 100%; height: 100%; } .image:nth-child(1){ transform: rotateY(0deg) translateZ(230px); } .image:nth-child(2){ transform: rotateY(60deg) translateZ(230px); } .image:nth-child(3){ transform: rotateY(120deg) translateZ(230px); } .image:nth-child(4){ transform: rotateY(180deg) translateZ(230px); } .image:nth-child(5){ transform: rotateY(240deg) translateZ(230px); } .image:nth-child(6){ transform: rotateY(300deg) translateZ(230px); } |