3d旋转相册代码源码附件(3d旋转相册带音乐编程代码)
本文目录一览:
html5 3d旋转相册代码怎么用
以下是代码:
!DOCTYPE html
html
head
titletransform-style实现Div的3D旋转-柯乐义/title
style
*{font-size: 24px;color: #00ff00; padding:0; margin:0;}
#container {
position: relative;
height: 300px;
width: 300px;
-webkit-perspective: 500;
margin-top: 200px;
margin-right: auto;
margin-left: auto;
}
#parent-keleyi-com {
margin: 10px;
width: 280px;
height: 280px;
background-color: #666;
opacity: 0.3;
-webkit-transform-style: preserve-3d;
-webkit-animation: spin 15s infinite linear;
}
#parent-keleyi-com div {
position: absolute;
top: 40px;
left: 40px;
width: 280px;
height: 200px;
padding: 10px;
-webkit-box-sizing: border-box;
}
#parent-keleyi-com :first-child {
background-color: #000;
-webkit-transform: translateZ(-100px) rotateY(45deg);
}
#parent-keleyi-com :last-child {
background-color: #333;
-webkit-transform: translateZ(50px) rotateX(20deg);
-webkit-transform-origin: 50% top;
}
/*执行Y轴旋转360度动画*/
@-webkit-keyframes spin {
from {-webkit-transform: rotateY(0);}
to {-webkit-transform: rotateY(360deg);}
}
/style
/head
body
div请使用支持CSS3的浏览器a href="" target="_blank"原文/a/div
div id="container"
div id="parent-keleyi-com"
diva href="/"柯乐义/a/div
diva href="/"keleyi.com/a/div
/div
/div
/body
/html
html5如何让图片3d旋转
1、首先打开html文件编辑器,这里使用vscode新建一个html文档,文档中写入基本的html结构,然后插入img标签并插入一张图片,给img一个class属性:
2、然后在上方的head标签中的style标签设置样式,这里设置图片的宽度和高度并设置相对定位,然后设置图片的鼠标悬浮样式,其中设置动画的形式为3d以及设置图片3d旋转偏移的角度,添加一个动画,设置好延时即可:
3、最后打开浏览器,就会看到一个图片:
4、当鼠标移动上去,图片就会自动3d旋转了:
html旋转相册代码
旋转index文件代码:
3D旋转相册
*{
padding:0;
margin:0;
}
body,
html{
height:100%;
}
/*背景图片在这里设置*/
body{
background-image:url("images/beijing.jpg");
background-size:100%100%;
}
#box{
width:280px;
height:400px;
position:fixed;
left:0;
right:0;
top:0;
bottom:0;
margin:auto;
transform-style:preserve-3d;
transform:rotateX(0deg)rotateY(0deg);
animation:go45slinearinfinite;
}
#boximg{
width:280px;
height:400px;
position:absolute;
left:0;
top:0;
}
#boximg:nth-child(1){
transform:rotateY(0deg)translateZ(650px);
}
#boximg:nth-child(2){
transform:rotateY(36deg)translateZ(650px);
}
#boximg:nth-child(3){
transform:rotateY(72deg)translateZ(650px);
}
#boximg:nth-child(4){
transform:rotateY(108deg)translateZ(650px);
}
#boximg:nth-child(5){
transform:rotateY(144deg)translateZ(650px);
}
#boximg:nth-child(6){
transform:rotateY(180deg)translateZ(650px);
}
#boximg:nth-child(7){
transform:rotateY(216deg)translateZ(650px);
}
#boximg:nth-child(8){
transform:rotateY(252deg)translateZ(650px);
}
#boximg:nth-child(9){
transform:rotateY(288deg)translateZ(650px);
}
#boximg:nth-child(10){
transform:rotateY(324deg)translateZ(650px);
}
@keyframesgo{
0%{
transform:rotateX(0deg)rotateY(0deg);
}
25%{
transform:rotateX(20deg)rotateY(180deg);
}
50%{
transform:rotateX(0deg)rotateY(360deg);
}
75%{
transform:rotateX(-20deg)rotateY(540deg);
}
100%{
transform:rotateX(0deg)rotateY(720deg);
}
}