js+css实现文字在3d弧线上跟随页面滚动效果代码

代码语言:html

所属分类:加载滚动

代码描述:js+css实现文字在3d弧线上跟随页面滚动效果代码,通过自定义一个HTMLElement ArcText来实现。

代码标签: js css 文字 3d 弧线 跟随 页面 滚动

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

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

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

    <link rel="preconnect" href="https://fonts.googleapis.com" />
    <link rel="preconnepct" href="https://fonts.gstatic.com" crossorigin />
    <link
      href="https://fonts.googleapis.com/css2?family=Anton&display=swap"
      rel="stylesheet"
    />
  
  
  
<style>
:root {
  font-family: "Anton", Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  font-weight: 400;
  background-color: #111;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  display: flex;
  place-items: center;
  min-width: 320px;
  min-height: 100vh;
  overflow: hidden;
  color: white;
}

#app {
  width: 100%;
  height: 100vh;
  display: flex;
  justify-content: center;
  overflow: hidden;
}

arc-text {
  --text-color: white;
  --bg-color: #111;
  --font-size: 120px;
  --radius: 6; /* approx ems */
  --fade-opacity: 1;
  --perspective: calc(var(--font-size) * 7);
  --overlay-opacity: 100%;
  --overlay-spread: 20%;
 .........完整代码请登录后点击上方下载按钮下载查看

网友评论0