Google AMP amp-anim

Опубликовано: 12 Апреля, 2022

Если вы хотите встроить анимацию на свою веб-страницу AMP, вы можете сделать это с помощью этого тега. Это помогает разработчику встраивать анимацию, gif, webp и т. Д. В вашу веб-платформу. Это действительно очень полезный тег, поскольку наличие анимации на вашем веб-сайте действительно делает его привлекательным и красивым.

Настраивать:

To use amp-anim in your AMP webpage, you have to import this script.

HTML

<script async custom-element="amp-anim" src=
</script>

It is similar to amp-img in most ways.

Example:

HTML

<!doctype html>
<html amp>
  
<head>
    <meta charset="utf-8">
  
    <title>Google AMP amp-anim</title>
      
    <script async src=
    </script>
      
    <script async custom-element="amp-anim" 
    </script>
      
    <meta name="viewport" content=
"width=device-width,minimum-scale=1,initial-scale=1">
      
    <link rel="canonical" href=
      
    <style amp-boilerplate>
        body {
            -webkit-animation: -amp-start 8s 
                steps(1, end) 0s 1 normal both;
  
            -moz-animation: -amp-start 8s 
                steps(1, end) 0s 1 normal both;
  
            -ms-animation: -amp-start 8s 
                steps(1, end) 0s 1 normal both;
  
            animation: -amp-start 8s 
                steps(1, end) 0s 1 normal both;
        }
  
        @-webkit-keyframes -amp-start {
            from {
                visibility: hidden
            }
  
            to {
                visibility: visible
            }
        }
  
        @-moz-keyframes -amp-start {
            from {
                visibility: hidden
            }
  
            to {
                visibility: visible
            }
        }
  
        @-ms-keyframes -amp-start {
            from {
                visibility: hidden
            }
  
            to {
                visibility: visible
            }
        }
  
        @-o-keyframes -amp-start {
            from {
                visibility: hidden
            }
  
            to {
                visibility: visible
            }
        }
  
        @keyframes -amp-start {
            from {
                visibility: hidden
            }
  
            to {
                visibility: visible
            }
        }
    </style>
  
    <noscript>
        <style amp-boilerplate>
            body {
                -webkit-animation: none;
                -moz-animation: none;
                -ms-animation: none;
                animation: none
            }
        </style>
    </noscript>
  
    <style amp-custom>
        h1 {
            color: green;
            text-align: center;
        }
    </style>
</head>
  
<body>
    <h1>
        Geeks For Geeks
    </h1>
      
    <amp-anim height="300" src=
        alt="an animation"
        attribution="GeeksForGeeks">
    </amp-anim>
</body>
  
</html>

Выход:

РЕКОМЕНДУЕМЫЕ СТАТЬИ