js+css实现鼠标交互式立体视觉差异图片动态反光跟随效果代码
代码语言:html
所属分类:视觉差异
代码描述:js+css实现鼠标交互式立体视觉差异图片动态反光跟随效果代码
代码标签: 交互式 立体 视觉 差异 图片 动态 反光 跟随 效果
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <style> *, *::before, *::after { font-family: inherit; box-sizing: inherit; margin: 0; padding: 0; } html { box-sizing: border-box; font-family: 'Nunito Sans', sans-serif; font-size: 62.5%; } html body { font-size: 1.6rem; margin: 0; } ul { list-style: none; } a, a:link, a:visited { text-decoration: none; } </style> <style> body { height: 100vh; overflow: hidden; background-color: #333; } main { width: 100%; height: 100%; position: relative; display: flex; align-items: center; justify-content: center; transform-style: preserve-3d; perspective: 100vmin; } main figure { --x: 0; --y: 0; position: relative; transform: rotateY(calc(var(--x) * 20deg)) rotateX(calc(var(--y) * -20deg)); width: 80vmin; height: 60vmin; } main figure img { width: 100%; height: 100%; -o-object-fit: cover; object-fit: cover; -o-object-position: center; object-position: center; padding: 1vmin; background-color: white; filter: sepia(0.85) saturate(1.4) brightness(calc(0.7 + (var(--x) + var(--y)) * -0.15)); } main figure .reflect { position: absolu.........完整代码请登录后点击上方下载按钮下载查看
网友评论0