js+svg实现翻书翻页效果代码
代码语言:html
所属分类:其他
代码描述:js+svg实现翻书翻页效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> body { display: grid; min-height: 100vh; place-content: center; margin: 0; padding: 0; overflow: hidden; background: linear-gradient(135deg, #fff 0%, #ddd 55%); } a.how-to { position: fixed; top: 0; left: 0; padding: 5vmin; color: #222; text-shadow: 0 0 1px #000a; } .wrap { width: 80vmin; height: 60vmin; position: relative; filter: drop-shadow(0 0 10px #0003); } .point { position: absolute; width: 1em; height: 1em; background: red; pointer-events: none; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; z-index: 10; } .point.r, .point.t, .point.q, .point.s { opacity: 0.1; } .point.p { pointer-events: unset; cursor: move; transform: translate(-50%, -50%) scale(1.25); text-indent: -100%; overflow: hidden; border-radius: 50%; } .page { width: 50%; height: 100%; position: absolute; top: 0; left: 0; } .page.front { z-index: 1; width: 100%; background: linear-gradient(#222, #444, #333); box-sizing: border-box; color: #eee; } .page.front > .content { display: grid; place-content: center; height: 100%; } .page.back { z-index: 2; } .page.back > .content { width: 100%; height: 100%; } .page.back > .content img { width: 100%; height: 100%; display: block; background: linear-gradient(#222, #444, #333); } .page.bottom { z-index: 0; -webkit-user-select: auto; -moz-user-select: auto; -ms-user-select: auto; user-select: auto; overflow: auto; -webkit-clip-path: url(#bar); clip-path: url(#bar); position: relative; overflow: hidden; display: grid; place-content: center; color: white; filter: drop-shadow(0 0 10px red); transition: all 0.3s; } .page.bottom a { text-decoration: underline; color: #eee; } .page.bottom::after { content: ""; display: block; width: 100%; height: 100%; position: absolute; top: 0; left: 0; z-index: -1; transform: scale(1.3); background: #333; -webkit-clip-path: url(#bar); clip-path: url(#bar); } .page.bottom:before { content: ""; position: absolute; left: -50%; top: -50%; z-index: -1; display: block; width: 200%; height: 200%; background: repeating-conic-gradient(lightblue, transparent, lightsalmon, transparent, lightblue 90deg); -webkit-animation: 10s f infinite linear; animation: 10s f infinite linear; } @-webkit-keyframes f { to { transform: rotate(1turn); } } @keyframes f { to { transform: rotate(1turn); } } .page.bottom:hover { filter: drop-shadow(0 0 10px purple); background: transparent; } .canvas { width: 100%; height: 100%; background: #0003; display: none; } </style> </head> <body > <div class="wrap"> <div class="point p">P</div> <div class="point q">Q</div> <div class="point r">R</div> <div class="point s">S</div> <div class="point t">T</div> <div class="page bottom"> <div class="content">牛</div> </div> <div class="page front"> <div class="content">牛年大吉</div> </div> <div class="page back"> <div class="content"><img src="//repo.bfw.wiki/bfwrepo/image/60330330a3a9e.png"/></div> </div> <canvas class="canvas"></canvas> </div> <svg width="0" height="0"> <defs> <clipPath id="bar" clipPathUnits="objectBoundingBox"> <path d="M0 0C.0507.1646.0973.3338.0999.5071.0901.6669.0465.8221.0065.9764 -0.0122 1.0248 .0695.9693 .0987.9702.1940.9438.2906.9210.3888.9081.4249.9398.4618.9707.5 1 .5379.9723.5687.9252.6091.9079.7420.9257.8723.9595 1 1 .9492.8353.9026.6661.9000.4928.9098.3330.9534.1778.9934.0235 1.012.........完整代码请登录后点击上方下载按钮下载查看
网友评论0