gsap+ScrollTrigger实现大气幻灯片拖动切换效果代码
代码语言:html
所属分类:幻灯片
代码描述:gsap+ScrollTrigger实现大气幻灯片拖动切换效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
* {
box-sizing: border-box;
}
:root {
--bg: #1a1a1a;
--min-size: 200px;
}
body {
display: grid;
place-items: center;
min-height: 100vh;
padding: 0;
margin: 0;
overflow-y: hidden;
background: var(--bg);
}
.controls {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%) scale(1.5);
z-index: 200;
display: flex;
justify-content: space-between;
min-height: var(--min-size);
min-width: var(--min-size);
height: 20vmin;
width: 20vmin;
}
button {
height: 48px;
width: 48px;
border-radius: 50%;
position: absolute;
top: 100%;
outline: transparent;
cursor: pointer;
background: none;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
border: 0;
transition: transform 0.1s;
transform: translate(0, calc(var(--y, 0)));
}
button:before {
border: 2px solid #e6e6e6;
background: linear-gradient(rgba(204,204,204,0.65), #000) #000;
content: '';
box-sizing: border-box;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
height: 80%;
width: 80%;
border-radius: 50%;
}
button:active:before {
background: linear-gradient(#000, rgba(204,204,204,0.65)) #000;
}
button:nth-of-type(1) {
right: 100%;
}
button:nth-of-type(2) {
left: 100%;
}
button span {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border-width: 0;
}
button:hover {
--y: -5%;
}
button svg {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%) rotate(0deg) translate(2%, 0);
height: 30%;
fill: #e6e6e6;
}
button:nth-of-type(1) svg {
transform: translate(-50%, -50%) rotate(180deg) translate(2%, 0);
}
.scroll-icon {
height: 30px;
position: fixed;
top: 1rem;
right: 1rem;
color: #e6e6e6;
-webkit-animation: action 4s infinite;
animation: action 4s infinite;
}
.boxes {
height: 100vh;
width: 100%;
overflow: hidden;
position: absolute;
transform-style: preserve-3d;
perspective: 800px;
touch-action: none;.........完整代码请登录后点击上方下载按钮下载查看
网友评论0