svg+gsap实现鼠标悬浮眼睛跟随软糖效果代码

代码语言:html

所属分类:悬停

代码描述:svg+gsap实现鼠标悬浮眼睛跟随软糖效果代码

代码标签: 悬浮 眼睛 跟随 软糖 效果

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

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

<head>

  <meta charset="UTF-8">
  

  
  
<style>
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@700&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  position; relative;
  height: 100vh;
  display: grid;
  place-items: center;
  background: radial-gradient(
    circle at center,
    hsl(339, 92%, 99%),
    hsl(339, 92%, 64%)
  );
}

svg {
  width: 90vmin;
  height: 90vmin;
  max-width: 640px;
}

.stars {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  opacity: 0;
}

.stars span {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}


.hover {
  position: absolute;
  bottom: 1rem;
  right: 1rem;
  font-size: 20px;
  font-weight: 700;
  color: #3B0216;
  font-family: 'Nunito', system-ui, sans-serif;
}
</style>



</head>

<body  >
  <svg fill="none" viewBox="0 0 200 200" style="opacity: 0;">
  <g>
    <g filter="url(#filter0_f)">
      <ellipse cx="100.5" cy="140.5" fill="#F84F8A" rx="60.5" ry="23.5" />
    </g>
    <path stroke="#3B0216" fill="url(#gradient)" stroke-width="2" d="M112.411 54.44l8.465 54.001C121.9 114.975 116.388 121 108.965 121h-16.93c-7.423 0-12.935-6.025-11.91-12.559l8.464-54C89.567 48.198 94.939 45 100.5 45c5.562 0 10.932 3.198 11.911 9.44z" />
    <path stroke="#3B0216" fill="url(#gradient)" stroke-w.........完整代码请登录后点击上方下载按钮下载查看

网友评论0