1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > css实现3d旋转图片魔方

css实现3d旋转图片魔方

时间:2022-04-16 09:57:06

相关推荐

css实现3d旋转图片魔方

css实现3d旋转图片魔方

代码部分:

<!doctype html><html><head><meta charset="utf-8"><title>无标题文档</title><style type="text/css">*{margin: 0;padding: 0;}ul li{list-style: none;}div{margin: 100px auto;width: 600px;height: 600px;position: relative;perspective: 1100px;}ul{width: 300px;height: 300px; position: absolute;left: 0;top: 0;bottom: 0;right: 0;margin: auto;transform-style: preserve-3d;/*捆绑动画 a为动画名 一次播放共5s linear为匀速播放 infinite为无限循环播放 */animation: a 5s linear infinite;} li{width: 300px;height: 300px;position: absolute;}li:nth-child(1){background: url("image/7.jpg") ;background-size: 100% 100%;transform: translateY(-150px) rotateX(90deg);}li:nth-child(2){background: url("image/8.jpg");background-size: 100% 100%;transform: translateY(150px) rotateX(-90deg);}li:nth-child(3){background: url("image/9.jpg");background-size: 100% 100%;transform: translateX(-150px) rotateY(-90deg);}li:nth-child(4){background: url("image/12.jpg");background-size: 100% 100%;transform: translateX(150px) rotateY(90deg);}li:nth-child(5){background: url("image/11.jpg");background-size: 100% 100%;transform:translateZ(150px);}li:nth-child(6){background: url("image/10.jpg");background-size: 100% 100%;transform: translateZ(-150px) rotateY(180deg);}/*设置动画*/@keyframes a{0%{transform: rotateX(0deg) rotateY(0deg);} /*从原始位置开始*/100%{transform: rotateX(360deg) rotateY(360deg);} /*到x y各旋转360度结束*/}</style></head><body><div><ul><li></li><li></li><li></li><li></li><li></li><li></li></ul></div></body></html>

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。