gsap实现重力吸引鼠标跟随小球效果代码
代码语言:html
所属分类:其他
代码描述:gsap实现重力吸引鼠标跟随小球效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
*,
*:after,
*:before {
box-sizing: border-box;
}
body {
display: grid;
place-items: center;
min-height: 100vh;
font-family: sans-serif, system-ui;
touch-action: none;
background: #18182f;
cursor: -webkit-grab;
cursor: grab;
}
.gravity-cursor {
pointer-events: none;
height: 50px;
aspect-ratio: 1;
background: white;
border-radius: 50%;
position: fixed;
top: 0;
left: 0;
transform: translate(-50%, -50%) translate(calc(var(--pointer-x) * 100vw), calc(var(--pointer-y) * 100vh)) scale(0.25);
z-index: 3;
transition: 0.1s;
}
.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0