Home>

I want to add a wavy animation to the characters with CSS like the URL below.
Variable font animation

However, even if I copy and paste, the animation is not set properly.
What is wrong?

Thanks for your professor.

The following error is displayed in the verification tool.

Uncaught ReferenceError: Splitting is not defined
Corresponding source code
<! DOCTYPE html>
<html>
<head>
  <meta charset = "utf-8" />
  <title>Page Title</title>
  <meta name = "viewport" content = "width = device-width, initial-scale = 1">
  <link rel = "stylesheet" type = "text/css" media = "screen" href = "sample.css" />
  <script src = "sample.js"></script>
</head>
<body>
     Breathing 
</body>
</html>
/ *
    Weight axis: 100 – 700
    Width axis: 85 – 100
* /
@ font-face {
    font-family: "arial";
    src: url ("https://s3-us-west-2.amazonaws.com/s.cdpn.io/85648/IBMPlexSansVar-Roman.ttf");
}
* {
    box-sizing: border-box;
}
body {
    font-family: "arial", Times;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 100vh;
    background-color: # DCEDC8;
}
h1 {
    font-weight: 100;
    font-size: 10vw;
    line-height: 10vw;
    font-variation-settings:'font-weight' 100,'font-stretch' 85;
}
h1 .char {
    --delay: calc ((var (--char-index) + 1) * 400ms);
    animation: breathe 4000ms infinite both;
    animation-delay: var (--delay);
}
h1: hover span {
    animation-play-state: paused;
}
@keyframes breathe {
    0% {
        font-variation-settings:'font-weight' 100,'font-stretch' 85;
        font-size: 10vw;
    }
    60% {
        font-variation-settings:'font-weight' 700,'font-stretch' 100;
        font-size: 11vw;
    }
    100% {
        font-variation-settings:'font-weight' 100,'font-stretch' 85;
        font-size: 10vw;
    }
}
Splitting ()
  • Answer # 1

    Good evening.

    Add the following to the head element. (Before splitting)

    <p>
    <script src = "https://unpkg.com/splitting/dist/splitting.min.js"></script>

    In Codepen, it is described in setting.