Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use css to realize 3D Image rotation effect

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces "how to use css to achieve 3D image rotation effect". In daily operation, I believe many people have doubts about how to use css to achieve 3D image rotation effect. Xiaobian consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the doubt of "how to use css to achieve 3D image rotation effect". Next, please follow the editor to study!

First of all, look at the html file, div.billboard is the effect of the container, using 10 div.poster to segment the image, each poster has three face, respectively used to carry three images.

XML/HTML Code copies content to the clipboard

CSS file here we use sass, using scss syntax.

CSS Code copies content to the clipboard

/ / variable initialization / / number of image blocks. If you want to change, html needs to modify $numPoster:10; / / rotate the number of images. If you want to change, html needs to modify $numFace:3; / / Image width $width:600px; / / Image height $height:320px / / the settings of the box .billboard {width:$width; margin:100px auto;} / / the image bar floats to the left. Poster {float:left; width:$width/$numPoster; height:$height } / / uniform setting of image strips, absolute positioning, 3D animation settings. Face {position:absolute; height:$height; width:$width/$numPoster; transform-origin:50% 50-17px; backface-visibility: hidden; transform-style:preserve-3d; perspective:350px } / / set the background image and animate @ for $I from 1 through $numFace {.poster .panel # {$I} {background:url (http://gx.zptc.cn/whqet/img/#{$i}.jpg); transform:transformY (360degapash facial numb * ($I-1)) respectively; animation: rotateMe# {$I} 10s infinite } @ keyframes rotateMe# {$I} {0% {transform:rotateY (360 degdegmax numFacebook * ($I-1));} 9% {transform:rotateY (360 degmax numFacebook * ($I-1));} 24% {transform:rotateY (360 degmax numFacebook * ($I)) } 42% {transform:rotateY (360 degmax numFacebook * ($I));} 57% {transform:rotateY (360 degmax numFacebook * ($I + 1));} 75% {transform:rotateY (360 degmax numFacebook * ($I + 1)) } 90% {transform:rotateY (360 degmax numFacebook * ($I + 2));} 100% {transform:rotateY (360 degmax numFacebook * ($I + 2)) } / / background offset of image strips @ for $I from 1 through $numPoster {.poster .p # {$I} {background-position:- ($width/$numPoster* ($I-1)) top;}} so far, the study on "how to use css to achieve 3D image rotation effect" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report