Home >Web Front-end >CSS Tutorial >How to Animate Handwritten Text on a Web Page Using SVG?

How to Animate Handwritten Text on a Web Page Using SVG?

Patricia Arquette
Patricia ArquetteOriginal
2024-12-02 17:12:12581browse

How to Animate Handwritten Text on a Web Page Using SVG?

How to Animate Handwriting Text on the Web Page Using SVG?

Problem:

I've been trying to mimic the handwriting text animation effect seen in examples like [this](http://codepen.io/se7ensky/pen/waoMyx) and [this](https://codepen.io/munkholm/pen/EaZJQE). However, I've only been able to animate the stroke rather than the entire text.

Code:

.test {
  width: 300px
  /*   margin:0 auto; */
}

.l1 {
  animation: dash 15s 1;
  stroke-linecap: round;
  stroke-miterlimit: 10;
  stroke-dasharray: 300;
  stroke-dashoffset: 300;
  animation-fill-mode: forwards;
  /*fill: none;*/
}

.l2 {
  stroke-dasharray: 300;
  stroke-dashoffset: 300;
  animation: dash 20s linear forwards;
  -webkit-animation-delay: 1s;
  /* Chrome, Safari, Opera */
  animation-delay: 1s;
}

.l3 {
  stroke-dasharray: 300;
  stroke-dashoffset: 300;
  animation: dash 25s linear forwards;
  -webkit-animation-delay: 2.5s;
  /* Chrome, Safari, Opera */
  animation-delay: 2.5s;
}

.l4 {
  stroke-dasharray: 300;
  stroke-dashoffset: 300;
  animation: dash 25s linear forwards;
  -webkit-animation-delay: 4.5s;
  /* Chrome, Safari, Opera */
  animation-delay: 4.5s;
}

@keyframes dash {
  to {
    stroke-dashoffset: 0;
  }
}
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 19.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
<svg class="test" version="1.1">

The above is the detailed content of How to Animate Handwritten Text on a Web Page Using SVG?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn