css实现一个地图折叠展开动画效果代码
代码语言:html
所属分类:动画
代码描述:css实现一个地图折叠展开动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> :root { --shadow-color: 0, 0, 0 ; --border-map: 1px dashed #6a5542 ; --shadow-bg: #130903; --map-img-url: url(//repo.bfw.wiki/bfwrepo/image/6032e655ee722.png); } body { margin: 0; padding: 0; display: flex; flex-wrap: wrap; background: url(//repo.bfw.wiki/bfwrepo/image/6032e554eeb71.png); } .map-container { position: relative; display: flex; align-items: center; justify-content: center; outline: none; width: 100vw; height: 100vh; } .map-container:before { content: ""; position: absolute; top: 0; left: 0; width: 100vw; height: 100vh; background: radial-gradient(transparent 0%, transparent 65%, #000000 100%); } .map { background: #e3d198; z-index: 13; transition: all 0.5s ease 0s; position: relative; display: flex; align-items: center; justify-content: center; outline: none; width: 16vw; height: 30vh; cursor: pointer; transform-origin: 0% 0%; perspective-origin: center; perspective: 800px ; border-radius: 5px; transform-origin: center; image-rendering: pixelated; } .map a { width: 16vw; height: 30vh; } .map div { position: absolute; backface-visibility: hidden; width: 16vw; height: 30vh; perspective-origin: center center; perspective: 100vw; background-color: #e3d198; } .front-mid { background: var(--map-img-url) no-repeat center calc(50% - 1px); z-index: 12; box-shadow: 0px 10px 10px -5px var(--shadow-bg), 5px 0px 10px -5px var(--shadow-bg), -5px 0px 10px -5px var(--shadow-bg); border-radius: 3px; transition: all 0.25s ease 1.5s; animation: initial-fold 6s 1; } .map:hover .front-mid { box-shadow: 0 0 0 0 #00000000; border-radius: 0; transition: all 0.25s ease 0.5s; } .front-top { background: var(--map-img-url) no-repeat center calc(50% + 30vh); z-index: 11; transition: all 0.4s ease 1.5s; transform-origin: center bottom; transform: rotateX(180deg); top: -30vh; border-top: var(--border-map); margin-top: -1px; animation: folding-top 6s 1; } .map:hover .front-top { transform: rotateX(0deg); transition: all 0.4s ease 0.25s; transform-origin: center bottom; } .front-bot { background: var(--map-img-url) no-repeat center calc(50% - 30vh - 1px); z-index: 10; transition: all 0.5s ease 1.25s; transform-origin: center top; transform: rotateX(-180deg); top: 30vh; border-bottom: var(--border-map); animation: folding-bot 6s 1; } .map:hover .front-bot { transform: rotateX(0deg); transition: all 0.5s ease.........完整代码请登录后点击上方下载按钮下载查看
网友评论0