js+css实现立体卡片式旋转木马式幻灯片效果代码
代码语言:html
所属分类:幻灯片
代码描述:js+css实现立体卡片式旋转木马式幻灯片效果代码,点击卡片可翻转为背面文字
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> :root { --primary-color: #870000; --secondary-color: #190a05; --card-width: 210px; --card-height: 350px; --border-color: #5a3e2b; --text-color: #a99383; --highlight-color: #ff9000; --shadow-color: rgba(0, 0, 0, 0.7); --card-bg-color: #1d0d06; } * { margin: 0; padding: 0; box-sizing: border-box; } body { font-family: "Times New Roman", serif; background: linear-gradient(135deg, #190a05 0%, #41251c 50%, #190a05 100%); background-attachment: fixed; min-height: 100vh; display: flex; justify-content: center; align-items: center; overflow-x: hidden; color: var(--text-color); position: relative; } body::before { content: ""; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><rect width="100" height="100" fill="none"/><path d="M0,0 L100,100 M100,0 L0,100" stroke="rgba(137, 0, 0, 0.1)" stroke-width="0.5"/></svg>'); opacity: 0.2; z-index: -1; } h1 { position: absolute; top: 50px; text-align: center; font-size: 2rem; width: 100%; color: var(--text-color); letter-spacing: 3px; text-shadow: 0 0 5px var(--shadow-color); font-weight: normal; } .scene { width: 100%; max-width: 1000px; height: 100vh; perspective: 1000px; display: flex; justify-content: center; align-items: center; } .carousel { width: 100%; height: 400px; position: relative; transform-style: preserve-3d; transform: translateZ(-400px); transition: transform 1s; } .card { width: var(--card-width); height: var(--card-height); position: absolute; top: 10px; left: 50%; transform: translateX(-50%) translateZ(400px); perspective: 1000px; transition: transform 1s; cursor: pointer; } .card-inner { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; transition: transform 0.8s ease; } .card.flipped .card-inner { transform: rotateY(180deg); } .card-front, .card-back { position: absolute; width: 100%; height: 100%; backface-visibility: hidden; display: flex; flex-direction: column; j.........完整代码请登录后点击上方下载按钮下载查看
网友评论0