svg+js实现文本输入发光滤镜动画效果代码

代码语言:html

所属分类:其他

代码描述:svg+js实现文本输入发光滤镜动画效果代码

代码标签: svg js 文本 输入 发光 滤镜 动画

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

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

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

  
  
  
  
<style>
/* Container styling */
.container {
  width: 100%;
  background-color: #000;
  border: 1px solid #000;
  padding: 8rem 4rem; /* py-32 px-16 */
  border-radius: 0.375rem; /* rounded-md */
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem; /* gap-4 */
  margin-bottom: 13rem; /* mb-52 */
  font-family:sans-serif;
}

/* Textarea styling */
.textarea {
  width: 20rem; /* w-80 */
  height: 3rem; /* h-12 */
  padding: 0.5rem; /* p-2 */
  background-color: #171717; /* bg-neutral-950 */
  color: white;
  border: 1px solid #404040; /* border-neutral-700 */
  outline: none;
  resize: none;
  transition: all 0.5s ease;
  border-radius: 0.375rem; /* rounded-md */
}

.textarea:focus {
  box-shadow: 0 0 0 1px #67e8f9; /* focus:ring-cyan-300 */
}

/* Text display styling */
.text-display {
  margin-top: 1rem; /* mt-4 */
  color: white;
  font-size: 1.25rem; /* text-xl */
  display: flex;
  flex-wrap: wrap;
  height: 13rem; /* h-52 */
  align-content: flex-start;
  justify-items: flex-start;
  width: 100%;
  filter: url(#bloom-filter);
}

/* Animated text styling */
.animated-text {
  font-weight: 600; /* font-semibold */
  font-size: 2.25rem; /* text-4xl */
  color: #06b6d4; /* text-cyan-500 */
  animation: colorChange 0.7s ease-in forwards;
}

/* Keyframe animation for text color */
@keyframes colorChange {
  from {
    color: white;
  }
  to {
    color: #06b6d4; /* text-cyan-500 */
  }
}
</style>


  
  
</head>

<body translate="no">
  <div class="container">
  <!-- SVG filter definitions -->
  <svg xmlns="http://www.w3.org/2000/svg" width="0" height="0">
    <defs>
      <filter
        id="bloom-filter"
        width="200%"
        height="200%"
        x="-50%"
        y="-50%"
      >
        <feComponentTransfer result="amplified">
          <feFuncR type="linear" slope="0.7" intercept="0"></feFuncR>
          <feFuncG type=.........完整代码请登录后点击上方下载按钮下载查看

网友评论0