纯css实现玻璃折射悬浮动画效果
代码语言:html
所属分类:动画
代码描述:纯css实现玻璃折射悬浮动画效果
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <style> :root { --tile: 40px; --radius: 50%; } BODY { display: -webkit-box; display: flex; -webkit-box-align: center; align-items: center; -webkit-box-pack: center; justify-content: center; min-height: 100vh; } .glass { position: relative; width: 400px; height: 400px; } .glass + .glass { margin-left: 1rem; } .glass:after, .glass:before { content: ''; display: block; position: absolute; top: 0; right: 0; bottom: 0; left: 0; -webkit-mask-position: 50% 50%; mask-position: 50% 50%; -webkit-transition: -webkit-mask-size .75s; transition: -webkit-mask-size .75s; transition: mask-size .75s; transition: mask-size .75s, -webkit-mask-size .75s; -webkit-transition-property: background-position, -webkit-mask-size; transition-property: background-position, -webkit-mask-size; transition-property: mask-size, background-position; transition-property: mask-size, background-position, -webkit-mask-size; } .glass--1, .glass--1:after, .glass--1:before { background: url(http://repo.bfw.wiki/bfwrepo/image/5d653bd0990d0.png?x-oss-process=image/auto-orient,1/resize,m_fill,w_400,h_400,/quality,q_90); background-size: 110% 110%; } .glass--1:after, .glass--1:before { -webkit-mask-image: -webkit-gradient(linear, left top, right bottom, color-stop(51%, white), color-stop(0, rgba(0, 0, 0, 0))); -webkit-mask-image: linear-gradient(to right bottom, white 51%, rgba(0, 0, 0, 0) 0); mask-image: -webkit-gradient(linear, left top, right bottom, color-stop(51%, white), color-stop(0, rgba(0, 0, 0, 0))); mask-image: linear-gradient(to right bottom, white 51%, rgba(0, 0, 0, 0) 0); -webkit-mask-size: var(--tile) var(--tile); mask-size: var(--tile) var(--tile); -webkit-mask-position: 50% 50%; mask-position: 50% 50%; } .glass--1.........完整代码请登录后点击上方下载按钮下载查看
网友评论0