C
C
Christina2017-05-26 06:32:56
css
Christina, 2017-05-26 06:32:56

How to make an image drawing animation from left to right?

And how to specify dasharray so that on all screens it is equal to the width of the window?

<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta name="viewport" content="width=device-width, minimum-scale=1, maximum-scale=1">
  <title>SVG</title>
  <link rel="icon" type="image/png" href="favicon.png" />
  <link rel="stylesheet" type="text/css" href="style.css">
  <script src="jquery-1.9.1.min.js"></script>
  </head>
<body>

<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 21.0.2, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
<svg version="1.1" id="Слой_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
     viewBox="0 0 460.3 46.2" style="enable-background:new 0 0 460.3 46.2;" xml:space="preserve">
<style type="text/css">
  .path{fill:#EE463B;}
</style>
  <g>
    <path class="path" stroke="#EE463B" d="M460.3,28.8c-0.4,0-0.7,0.1-1.1,0.1c-12,0-24,0-36,0c-1.3,0-2.6-0.1-3.8-0.2c-1.5-0.1-2.7-0.9-3.6-2.1
    c-0.5-0.6-1.1-1.3-1.8-1.8c-1.4-1.2-2.5-1.1-3.8,0.2c-0.5,0.5-0.9,1-1.4,1.5c-1.6,1.8-3.5,3-6,2.7c-1.1-0.1-1.7,0.4-2.1,1.4
    c-1,2.2-1.9,4.3-3,6.4c-0.7,1.4-1.8,2.2-3.5,2.1c-1.2-0.1-2.1-0.5-2.5-1.6c-2.3-6-4.6-12-7-18c-0.7-1.8-1.5-3.6-2.3-5.4
    c-0.5-1.2-1.7-1.3-2.5-0.2c-0.4,0.5-0.6,1.2-0.9,1.8c-1.6,4.2-3.1,8.3-4.6,12.5c-1.1,2.9-3.2,3.2-5.3,1c-0.1-0.1-0.1-0.1-0.2-0.2
    c-1.8-1.9-1.8-1.8-4.2-1c-1.2,0.4-2.6,0.8-3.8,0.8c-14.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8-2.6,8.5-0.4
    c0.5,0.6,1.1,1.2,1.6,1.8c1.1,1.1,2.4,1.6,3.9,1.6c12,0,24.1,0,36.1,0c0.8,0,1.6,0,2.4,0C460.3,28.4,460.3,28.6,460.3,28.8z"/>
  </g>
</svg>

</body>
</html>

.path {
  stroke-dasharray: 100 1680;
  stroke-dashoffset: 100;
  animation: dash 10s linear forwards;
}

@keyframes dash {
  from {
    stroke-dashoffset: 100;
  }
  to {
    stroke-dashoffset: -1680;
  }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
A person from Kazakhstan, 2017-05-26
@KrisIris

Well, actually, the movement from left to right is by default .. I just checked it (I took the girl from tyrnet and converted it to svg and animated it) https://codepen.io/Geyan/pen/BREzXr
This is your example with implementation : https:// codepen.io/Geyan/pen/NjmRNO?editors=1100

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question