div+css实现光线照射卡片边缘动态滚动效果代码

代码语言:html

所属分类:加载滚动

代码描述:div+css实现光线照射卡片边缘动态滚动效果代码,滚动网页就能看到效果,左侧光源照射元素的边框跟随光线方位变动。

代码标签: div css 光线 照射 卡片 边缘 动态 滚动

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

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

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

<link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/inter.4.0.2.css">
    <style>
        :root {
      --bg: #b8b8b8;
      --light: #fff;
      --card: #262626;
      --text: #111;
    }
    
    body {
      margin: 0;
      background-color: var(--bg);
      font-family: Inter, sans-serif;
      font-size: 5rem;
      font-weight: bold;
      color: var(--text);
      padding: 5rem 0;
    }
    
    #light {
      position: fixed;
      top: 50%;
      left: 0;
      transform: translate(-50%, -50%);
      display: flex;
      flex-direction: row;
      justify-content: center;
      align-items: center;
    }
    
    .circle {
      height: 30rem;
      width: 30rem;
      background-color: var(--light);
      display: block;
      border-radius: 100rem;
      filter: blur(1em);
      z-index: 0;
    }
    
    .oval {
      position: absolute;
      height: 10rem;
      width: 5rem;
      background-color: var(--light);
      display: block;
      border-radius: 100rem;
      filter: blur(2em);
      z-index: -10;
    }
    
    /* card */
    
    section {
      display: flex;
      flex-direction: column;
      justify-content: flex-start;
      align-items: center;
      view-timeline: --section;
    }
    
    .card {
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      height: 30rem;
      width: 50vw;
      margin: 5rem 0;
      border-radius: 5rem;
      animation: adjust-offset both ease-in-out;
      animation-timeline: view();
      z-index: 1;
      border: 2px solid transparent;
      background-origin: border-box.........完整代码请登录后点击上方下载按钮下载查看

网友评论0