js+css实现iPhone图片图标鼠标悬浮倾斜移动交互效果代码
代码语言:html
所属分类:悬停
代码描述:js+css实现iPhone图片图标鼠标悬浮倾斜移动交互效果代码
代码标签: js css iPhone 图片 图标 鼠标 悬浮 倾斜 移动 交互
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> body { display: grid; place-items: center; height: 100vh; margin: 0; background: #f8f8f8; perspective: 1000px; } .photos { position: relative; display: block; width: 50vh; height: 50vh; transition: transform 200ms ease-out; transform-style: preserve-3d; } .bg { position: absolute; top: 0; right: 0; bottom: 0; left: 0; border-radius: 50%; background-color: #fcfcfc; box-shadow: white 0 -4px 8px 2px inset, rgba(0, 0, 0, 0.02) 0 -6px 40px; } .icons { display: block; width: 100%; height: 100%; transform-style: preserve-3d; transform: translateZ(50px); } .icon-1 { --color: #faaa31; --rotate: 0deg; } .icon-2 { --color: #f6e422; --rotate: 45deg; } .icon-3 { --color: #b9d753; --rotate: 90deg; } .icon-4 { --color: #6cbeb0; --rotate: 135deg; } .icon-5 { --color: #79addc; --rotate: 180deg; } .icon-6 { --color: #a48dc1; --rotate: 225deg; } .icon-7 { --color: #d388b1; --rotate: 270deg; } .icon-8 { --color: #f37a5d; --rotate: 315deg; } .color, .shadow { position: absolute; top: 50%; left: 50%; display: block; width: 11.9047619048vh; height: 18.5185185185vh; transform: translate(-50%, -107%) rotateZ(var(--rotate)); transform-origin: 50% 107%; border-radius: 11.9047619048vh; box-shadow: rgba(255, 255, 255, 0.3) 2px 2px 3px 0 inset, color-mix(in srgb, var(--color) 30%, black 1%) 8px 4px 20px; /*span { // content: ''; display: block; // border-radius: $width; position: absolute; //z-index: -1; //background: fuchsia; // var(--color); width: 100%; height: 100%; } span:first-child { // opacity: 0.2; // filter: blur(5px); //transform: rotateX(45deg) translateZ(-200px); //transform: translate(50%, $gap) rotate(calc(var(--rotate) * -1) translateZ(-200px) translateZ(-200px); background: var(--color); opacity: 0.35; transform: translateZ(-50px); border-radius: $width; filter: blur(10px); transform-style: preserve-3d; // backface-visibility: visible; //mix-blend-mode: multiply; } span:last-child { border-radius: $width; background: var(--color); transform: translateZ(-3px); //opacity: .9; // mix-blend-mode: multiply; }*/ } .color span, .shadow span { .........完整代码请登录后点击上方下载按钮下载查看
网友评论0