div+css实现页面滚动镜头聚焦虚化背景效果代码

代码语言:html

所属分类:加载滚动

代码描述:div+css实现页面滚动镜头聚焦虚化背景效果代码

代码标签: div css 页面 滚动 镜头 聚焦 虚化 背景

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

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

<head>
 
<meta charset="UTF-8">
 

 
 
<style>
@import url("https://fonts.googleapis.com/css2?family=Varela+Round&display=swap");

body {
        height: 150vh;
        margin: 0;
        padding: 0;
        width: 100%;
}

body * {
        box-sizing: border-box;
        font-family: "Varela Round", cursive;
}

.front-box,
.back-box {
        position: fixed;
        perspective: 400px;
        width: 100vw;
        height: 100vh;
        overflow: hidden;
        transform-style: preserve-3d;
}

.front-box {
        z-index: 2;
}

.back-box {
        z-index: 1;
}

.front,
.back {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-repeat: no-repeat;
        animation: go-front linear both;
        animation-timeline: scroll(root);
}

.front-box .front {
        background-image: url(//repo.bfw.wiki/bfwrepo/icon/6685c3032e3ab.png);
        background-size: contain;
        background-position: 100% 50%;
}

.back-box .back {
        background-image: url(//repo.bfw.wiki/bfwrepo/image/6685c358a0d6b.pn.........完整代码请登录后点击上方下载按钮下载查看

网友评论0