gsap模仿apple tv实现图片悬浮视觉差异聚焦效果代码

代码语言:html

所属分类:视觉差异

代码描述:gsap模仿apple tv实现图片悬浮视觉差异聚焦效果代码

代码标签: gsap 模仿 apple tv 图片 悬浮 视觉差异 聚焦

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en" >

<head>

  <meta charset="UTF-8">
  

  
  
  
<style>
body {
    overscroll-behavior: none;
    cursor: none;
    transform-style: preserve-3d;
}
* {
    margin: 0;
    padding: 0;
}
#container {
    width: 100vw;
    height: 100vh;
    display: grid;
    place-items: center;
}
.grid {
    display: flex;
    flex-wrap: wrap;
}
.grid__wrap {
    position: relative;
    margin: 0 40px;
}
.grid__button {
    width: 200px;
    height: 50px;
    background-color: indigo;
    display: grid;
    place-items: center;
    color: white;
}
.grid__area {
    width: 250px;
    height: 150px;
    position: absolute;
    top: 0;
    bottom: 0;
    left: -100%;
    right: -100%;
    margin: auto;
}
.cursor {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 9999;
    pointer-events: none;
    contain: layout size style;
}
.cursor__pointer {
    position: absolute;
    width: 15px;
    height: 15px;
    background-color: red;
    border-radius: 50%;
    opacity: 0;
}
.cursor__decoy {
    position: absolute;
}
.cursor__decoy span {
    display: block;
    width: 10px;
    height: 10px;
    background-color: rgba(0,255,0,.6);
    border-radius: 50%;
    opacity: 0;
}

.discography {
    display: flex;
    perspective: 350px;
}

.discography__unit {
    position: relative;
    width: 350px;
    perspective: 300px;
}

.discography__unit:nth-child(n+2) {
    margin-left: 80px;
}

.discography__image {
    overflow: hidden;
    box-shadow: 21px 42px 42px rgba(0, 0, 0, .33);
}

.discography__image img {
    max-width: 100%;
    vertical-align: bottom;
}

.discography__area {
    position: absolute;
    top: -100%;
    right: -100%;
    bottom: -100%;
    left: -100%;
    width: 130%;
    height: 130%;
    margin: auto;
}

.discography__light {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    width: 50%;
    height: 50%;
    margin: auto;
    filter: blur(36px) brightness(1.05);
    background-color: hsla(0, 0%, 100%, 0.85);
    border-radius: 50%;
}
</style>



</head>

<body  >
  <div id="container">
        <div class="discography">
            <div class="discography__unit">
                <div class="discography__image">
                    <img src="//repo.bfw.wiki/bfwrepo/image/625a2405efdde.png?x-oss-process=image/auto-orient,1/resize,m_fill,w_400,h_400,/quality,q_90" alt="">
                    <div class="discography__light"></div>
                </div>
                <div class="discography__area"></div>
            </div>
            <div class="discography__unit">
                <div class="discography__image">
                    <img src="//repo.bfw.wiki/bfwrepo/image/626903b0b64e2.png?x-oss-process=image/auto-orient,1/resize,m_fill,w_400,h_400,/quality,q_90" alt="">
                    <div class="discography__light"></div>
                </div>
                <div class="discography__area"></div>
            </div>
        </div>
    </div>
    <div id="cursor" class="cursor">
        <div class="cursor__target cursor__pointer"></div>
        <div class="cursor__target cursor__decoy"><span></span></div>
    </div>

<script type="text/javascript" src="//repo.bfw.wiki/bfw.........完整代码请登录后点击上方下载按钮下载查看

网友评论0