js+css实现可手动切换的三维立体翻转图片幻灯片代码

代码语言:html

所属分类:幻灯片

代码描述:js+css实现可手动切换的三维立体翻转图片幻灯片代码

代码标签: js css 手动 切换 三维 立体 翻转 图片 幻灯片 代码

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">

  
  
  
<style>
:root {
  --color-primary: dimgray;
  --rotation-speed: 1s;
}

* {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}

html {
  min-height: 100vh;
  display: grid;
  place-items: center;
}
body {
  background: linear-gradient(to top, #222, #ddd);
}

.container {
  height: 100%;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  perspective: 800px;
  perspective-origin: 50%;
}
.image-cube {
  width: 300px;
  height: 300px;
  transform-style: preserve-3d;
  position: relative;
  transition: var(--rotation-speed);  
}
.image-cube div {
  height: 300px;
  width: 300px;
  position: absolute;
  background-size: cover;
  background-position: 50% 50%;
  border: 3px solid white;
  -webkit-box-reflect: below -3px linear-gradient(to bottom, rgba(0,0,0,0) 80%, rgba(0,0,0,0.15));
}

.front {
  background-image: url('//repo.bfw.wiki/bfwrepo/image/66487d06b98c4.png');
  transform: translateZ(150px);
}
.right {
  background-image: url('//repo.bfw.wiki/bfwrepo/image/66487d16d5096.png');
  transform: rotateY(-270deg) translateX(150px);
  transform-origin: 100% 0;
}
.back {
  background-image: url('//repo.bfw.wiki/bfwrepo/image/66487d29d9875.png');
  transform: translateZ(-150px) rotateY(180deg);
}
.left {
  background-image: url('//repo.bfw.wiki/bfwrepo/image/66487d566defb.png');
  transform: rotateY(270deg) translateX(-150px);
  transform-origin: 0 50%;
}
.btns {
  position: absolute;
  display: flex;
  justify-content: space-between;
  width: 405px;
  pointer-events: none;
}
.btns button {
  background-color: transparent;
  color: #ffffff;
  border: 3px solid #fffff.........完整代码请登录后点击上方下载按钮下载查看

网友评论0