{"id":311797,"date":"2020-10-21T09:00:23","date_gmt":"2020-10-21T09:00:23","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=311797"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=311797","title":{"rendered":"\u041a\u0430\u043a \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0443 \u0434\u043b\u044f Vue \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 SVG"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\u0411\u044b\u0432\u0430\u0435\u0442, \u0447\u0442\u043e \u043d\u0430 \u0441\u0430\u0439\u0442\u0435, \u0432 \u043a\u043e\u0440\u043f\u043e\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0439 IT-\u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0438\u043b\u0438 \u0434\u0440\u0443\u0433\u043e\u043c \u041f\u041e \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c \u043a\u0440\u0443\u0433\u043e\u0432\u044b\u0435 \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u044b \u0441 \u043a\u0430\u043a\u0438\u043c\u0438-\u043b\u0438\u0431\u043e \u0434\u0430\u043d\u043d\u044b\u043c\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0442\u0430\u0439\u043c\u0435\u0440 \u0434\u043b\u044f \u043e\u0442\u0441\u0447\u0435\u0442\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0438\u043b\u0438 \u0438\u043d\u0434\u0438\u043a\u0430\u0442\u043e\u0440, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u043e\u0432\u0430\u0440\u043e\u0432 \u043f\u0440\u043e\u0434\u0430\u043d\u043e \u0432 \u0442\u043e\u0439 \u0438\u043b\u0438 \u0438\u043d\u043e\u0439 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438. \u0415\u0441\u043b\u0438 \u044d\u0442\u043e \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \u0444\u043e\u0440\u043c\u0430\u0442\u043e\u043c svg, png \u0438\u043b\u0438 gif. \u041e\u0434\u043d\u0430\u043a\u043e, \u0437\u0430\u0447\u0430\u0441\u0442\u0443\u044e \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0434\u0438\u043d\u0430\u043c\u0438\u043a\u0435 \u2013 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430 \u0438\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u043b\u044f \u043f\u0440\u0438\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u044f \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439, \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043a\u0440\u0430\u0441\u0438\u0432\u043e\u0439 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438 \u043f\u0440\u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0435 \u0441\u0430\u0439\u0442\u0430. \u0414\u0435\u043b\u0438\u043c\u0441\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0443 \u0438\u0437 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 SVG \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e JS \u0438 CSS. <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/il\/9h\/3k\/il9h3kehvscsjwa9ftcje3jtwdu.png\"><a name=\"habracut\"><\/a><\/p>\n<p>  \u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c, \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0443 \u0431\u0435\u0437 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a. \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0439 VUE-\u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442, \u043d\u0430\u0447\u043d\u0451\u043c \u0441 \u043e\u0441\u043d\u043e\u0432\u044b \u2013 \u0448\u0430\u0431\u043b\u043e\u043d\u0430.<\/p>\n<pre><code class=\"javascript\">&lt;template&gt;   &lt;svg class=&quot;diagram&quot; viewBox=&quot;0 0 42 42&quot;&gt;   \t&lt;!\u2014- \u0424\u043e\u043d\u043e\u0432\u044b\u0439 \u043a\u0440\u0443\u0433, \u043f\u043e\u0434\u043b\u043e\u0436\u043a\u0430 --&gt;     &lt;circle       :class=&quot;classCircleBack&quot;       :r=&quot;radius&quot;       cx=&quot;50%&quot;       cy=&quot;50%&quot;       :stroke-dashoffset=&quot;dashoffset&quot;     \/&gt;   \t&lt;!\u2014- \u0412\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 \u043a\u0440\u0443\u0433, \u044d\u0442\u043e \u0438 \u0435\u0441\u0442\u044c \u0441\u0430\u043c \u0433\u0440\u0430\u0444\u0438\u043a --&gt;     &lt;circle       ref=&quot;mainDiagram&quot;       class=&quot;front&quot;       :class=&quot;classCircleFront&quot;       :stroke-dasharray=&quot;dasharray&quot;       :r=&quot;radius&quot;       cx=&quot;50%&quot;       cy=&quot;50%&quot;     \/&gt; &lt;!\u2014- \u0421\u043f\u0443\u0442\u043d\u0438\u043a, \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442, \u043d\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u2014-&gt; &lt;!\u2014- \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442  \u0432\u0430\u0448\u0435\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 --&gt;     &lt;circle       v-if=&quot;satellite&quot;       class=&quot;satellite&quot;       r=&quot;1&quot;       cx=&quot;101%&quot;       cy=&quot;50%&quot;       :style=&quot;rotate&quot;     \/&gt;   &lt;\/svg&gt; &lt;\/template&gt;<\/code><\/pre>\n<p>  \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 CX \u0438 CY \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0446\u0435\u043d\u0442\u0440\u0430 \u043e\u043a\u0440\u0443\u0436\u043d\u043e\u0441\u0442\u0438 \u0444\u0438\u0433\u0443\u0440\u044b &lt;CIRCLE \/&gt;, \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u0440\u0430\u0437\u043c\u0435\u0449\u0430\u044f \u043e\u0431\u044a\u0435\u043a\u0442 \u043f\u043e \u0446\u0435\u043d\u0442\u0440\u0443 \u0445\u043e\u043b\u0441\u0442\u0430. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0432\u0430\u0436\u043d\u043e \u043f\u043e\u043c\u043d\u0438\u0442\u044c, \u0447\u0442\u043e \u0432 svg \u0445\u043e\u043b\u0441\u0442\u0430\u0445 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0439 \u043e\u0442\u0441\u0447\u0451\u0442 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442, \u0438 \u0435\u0434\u0438\u043d\u0438\u0446\u0435\u0439 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f \u043d\u0435 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043f\u0438\u043a\u0441\u0435\u043b\u0438. \u041d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c \u0432 \u0442\u0435\u0433\u0435 svg \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0430\u0442\u0440\u0438\u0431\u0443\u0442 <b>viewBox=\u00ab0 0 42 42\u00bb<\/b> \u0434\u043b\u044f \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0445\u043e\u043b\u0441\u0442\u0430.<\/p>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u043e\u0434 \u043d\u0430 VUE, \u0447\u0430\u0441\u0442\u0438\u0447\u043d\u043e \u0441 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c TypeScript. \u0412\u0441\u044f \u201c\u043c\u0430\u0433\u0438\u044f\u201d \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u044b \u0438 \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0435\u0439 \u0437\u0434\u0435\u0441\u044c \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c \u0437\u0430 \u0441\u0447\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 <b>stroke-dasharray<\/b> \u0432 \u0442\u0435\u0433\u0435 circle \u2013 \u043d\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043e\u043f\u0438\u0448\u0435\u043c \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430:<\/p>\n<pre><code class=\"javascript\">import Vue, { PropType } from 'vue'   export default Vue.extend({   name: 'Diagram',   props: {     \/\/ \u0421\u0432\u043e\u0439\u0441\u0442\u0432\u043e, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 \u0447\u0438\u0441\u0435\u043b, \u0433\u0434\u0435:     \/\/ \u043d\u0443\u043b\u0435\u0432\u043e\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u2013 \u044d\u0442\u043e \u0434\u043b\u0438\u043d\u0430 \u043e\u0442\u0440\u0435\u0437\u043a\u0430 \u0434\u043b\u044f \u0432\u0438\u0434\u0438\u043c\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 stroke-dasharray     \/\/ \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0441 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c 1 \u2013 \u044d\u0442\u043e \u0434\u043b\u0438\u043d\u0430 \u0432\u0441\u0435\u0433\u043e \u043e\u0442\u0440\u0435\u0437\u043a\u0430     \/\/ \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0438\u0437 78 \u044f\u0431\u043b\u043e\u043a \u043f\u0440\u043e\u0434\u0430\u043d\u043e 25, \u0437\u043d\u0430\u0447\u0438\u0442, \u043f\u0440\u043e\u043f\u0441 \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u0440\u0438\u043d\u044f\u0442\u044c [25, 78]     dataDasharray: {       type: Array as PropType&lt;number[]&gt;,       required: true     },     \/\/ \u0420\u0430\u0434\u0438\u0443\u0441, \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u043e\u043f\u0441, \u043c\u043e\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0432 \u043b\u044e\u0431\u044b\u0445 \u0435\u0434\u0438\u043d\u0438\u0446\u0430\u0445 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f     radius: {       type: String,       required: false,     },     \/\/ \u041a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0439 css \u043a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f \u0441\u0442\u0438\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0444\u043e\u043d\u043e\u0432\u043e\u0439 \u0444\u0438\u0433\u0443\u0440\u044b \u043a\u0440\u0443\u0433\u0430     classCircleBack: {       type: String,     },     \/\/ \u041a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0439 css \u043a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f \u0441\u0442\u0438\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u0440\u0443\u0433\u0430     classCircleFront: {       type: String,     },     \/\/ \u0415\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u0430 \u0444\u0438\u0433\u0443\u0440\u0430-\u0441\u043f\u0443\u0442\u043d\u0438\u043a     satellite: {       type: Boolean,     }   },   data() {     return {       dasharray: '0 0', \/\/ \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u0441\u0435\u0432\u0434\u043e\u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u043e\u0442\u0440\u0435\u0437\u043a\u0430       dashoffset: '100', \/\/ \u0414\u043b\u0438\u043d\u0430 \u043e\u043a\u0440\u0443\u0436\u043d\u043e\u0441\u0442\u0438 \u0434\u043b\u044f \u0444\u0438\u0433\u0443\u0440\u044b \u043f\u043e\u0434\u043b\u043e\u0436\u043a\u0438 \u2013 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u043e\u0431\u0432\u043e\u0434\u043a\u0438 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f       radiusBaseVal: 0, \/\/ \u043f\u0440\u043e \u044d\u0442\u0443 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0447\u0443\u0442\u044c \u043d\u0438\u0436\u0435       circumference: 0 \/\/ \u0414\u043b\u0438\u043d\u0430 \u043e\u043a\u0440\u0443\u0436\u043d\u043e\u0441\u0442\u0438, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u043c \u043f\u043e\u0437\u0436\u0435     }   }<\/code><\/pre>\n<p>  \u0420\u0430\u043d\u0435\u0435 \u043c\u044b \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043b\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442, \u0442\u0435\u043f\u0435\u0440\u044c \u043a \u043d\u0435\u043c\u0443 \u043d\u0443\u0436\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b.<\/p>\n<pre><code class=\"javascript\">\/\/ \u0412\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c\u044b\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0434\u043b\u044f \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438 \u0441\u043f\u0443\u0442\u043d\u0438\u043a\u0430   computed: {     rotate(): string {       \/\/ \u041f\u043e\u0432\u043e\u0440\u043e\u0442 \u0441\u043f\u0443\u0442\u043d\u0438\u043a\u0430 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0446\u0435\u043d\u0442\u0440\u0430 \u0445\u043e\u043b\u0441\u0442\u0430 \u0434\u043b\u044f \u0438\u043d\u043b\u0430\u0439\u043d\u043e\u0432\u043e\u0433\u043e \u0441\u0442\u0438\u043b\u044f       return `transform: rotate(${this.degRotate}deg);`     },     degRotate() {       \/\/ \u0412\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u0433\u0440\u0430\u0434\u0443\u0441 \u043f\u043e\u0432\u043e\u0440\u043e\u0442\u0430 \u0441\u043f\u0443\u0442\u043d\u0438\u043a\u0430, \u043e\u0441\u043d\u043e\u0432\u044b\u0432\u0430\u044f\u0441\u044c \u043d\u0430 \u043f\u0440\u043e\u043f\u0441\u0435 dataDasharray       const percent: number = Number(         ((this.dataDasharray[0] * 100) \/ this.dataDasharray[1]).toFixed(1)       )       return (-360 * (percent \/ 100) - 90).toFixed(1)     }   }<\/code><\/pre>\n<p>  \u0412 \u044d\u0442\u043e\u043c \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u0430 \u0447\u0438\u0441\u043b\u043e\u0432\u0430\u044f \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0430 <b>-360<\/b>. \u041e\u043d\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430 \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0437\u0435\u0440\u043a\u0430\u043b\u044c\u043d\u043e \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u00ab\u0441\u043f\u0443\u0442\u043d\u0438\u043a\u0430\u00bb, \u0438\u043d\u0430\u0447\u0435 \u0441\u0430\u0442\u0435\u043b\u043b\u0438\u0442 \u0431\u0443\u0434\u0435\u0442 \u0434\u0432\u0438\u0433\u0430\u0442\u044c\u0441\u044f \u043f\u0440\u043e\u0442\u0438\u0432 \u0447\u0430\u0441\u043e\u0432\u043e\u0439 \u0441\u0442\u0440\u0435\u043b\u043a\u0438 \u2013 \u0432\u043e\u043f\u0440\u0435\u043a\u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438 \u043a\u0440\u0443\u0433\u043e\u0432\u043e\u0439 \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u044b.<\/p>\n<p>  \u041f\u043e\u0434\u0447\u0435\u0440\u043a\u043d\u0435\u043c, \u0447\u0442\u043e \u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 \u0448\u0430\u0433\u0443 \u043c\u044b \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u043e\u0433\u0434\u0430, \u043a\u043e\u0433\u0434\u0430 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 vue \u0431\u0443\u0434\u0435\u0442 \u0441\u043c\u043e\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d \u2013 \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0441\u0442\u044c <b><a href=\"https:\/\/ru.vuejs.org\/v2\/api\/#ref\">ref<\/a><\/b>. \u0417\u0430\u0442\u0435\u043c \u0432\u044b\u0441\u0442\u0430\u0432\u0438\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0434\u0432\u0443\u0445 \u0432\u0430\u0436\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445:<\/p>\n<pre><code class=\"javascript\">mounted() {     this.radiusBaseVal = (this.$refs.mainDiagram as any).r.baseVal.value     this.circumference = 2 * Math.PI * this.radiusBaseVal   } <\/code><\/pre>\n<p>  <b>radiusBaseVal<\/b> \u2013 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 <a href=\"https:\/\/www.w3.org\/TR\/SVG11\/single-page.html#types-InterfaceSVGAnimatedLength\">\u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u044b\u0439 \u0440\u0430\u0434\u0438\u0443\u0441<\/a> \u0444\u0438\u0433\u0443\u0440\u044b &lt;circle\/&gt;. \u0412\u0430\u0436\u043d\u043e \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u044d\u0442\u043e\u0442 \u0440\u0430\u0434\u0438\u0443\u0441 \u043d\u0435 \u0441\u0432\u044f\u0437\u0430\u043d \u0441 \u0440\u0430\u0434\u0438\u0443\u0441\u043e\u043c \u0432 \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0435 html.<\/p>\n<p>  <b>circumference<\/b> \u2013 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0434\u043b\u0438\u043d\u044b \u043e\u043a\u0440\u0443\u0436\u043d\u043e\u0441\u0442\u0438 (\u043f\u0440\u0438\u0432\u0435\u0442 \u0448\u043a\u043e\u043b\u044c\u043d\u043e\u0439 \u0442\u0440\u0438\u0433\u043e\u043d\u043e\u043c\u0435\u0442\u0440\u0438\u0438!).<\/p>\n<p>  \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0435 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u043e\u0434\u0438\u043d \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 <b>stroke-dashoffset<\/b> \u0432 \u0444\u0438\u0433\u0443\u0440\u0435 \u043f\u043e\u0434\u043b\u043e\u0436\u043a\u0438 \u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 <b>stroke-dasharray<\/b> \u0432\u043e \u0432\u043d\u0435\u0448\u043d\u0435\u0439 \u0444\u0438\u0433\u0443\u0440\u0435. \u0412\u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0438 \u043c\u044b \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c \u043a \u043d\u0438\u043c \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044e.<\/p>\n<pre><code class=\"javascript\">methods: {     setLengthDasharray(percent, circumference) {       const offset = circumference - (percent \/ 100) * circumference       this.dasharray = `${offset} ${circumference}`       this.dashoffset = circumference.toFixed(3)     }   }<\/code><\/pre>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u0432\u0441\u044f \u0441\u043e\u043b\u044c \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0432\u043e\u0442\u0447\u0435\u0440\u0435, \u0433\u0434\u0435 \u0438 \u0441\u0442\u0430\u0440\u0442\u0443\u0435\u0442 \u201c\u043c\u0430\u0433\u0438\u044f\u201d \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430:<\/p>\n<pre><code class=\"javascript\">watch: {     dataDasharray: {       handler() {         \/\/ \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u043d\u043e\u0435 \u0441\u043e\u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u043f\u0440\u043e\u043f\u0441\u0430 dataDasharray         const percent = (       \t(this.dataDasharray[0] * 100) \/ this.dataDasharray[1]     \t).toFixed(1)         \/\/ \u0421\u0435\u0442\u0438\u043c \u0434\u043b\u0438\u043d\u0443 \u043e\u0444\u0444\u0441\u0435\u0442\u043e\u0432 \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0439 \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u044b         this.setLengthDasharray(percent, this.circumference)       },       deep: true, \/\/ \u0413\u043b\u0443\u0431\u043e\u043a\u043e\u0435 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u043f\u0441\u0430 dataDasharray       immediate: true \/\/ \u0437\u0430\u043f\u0443\u0441\u043a handler \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u0440\u0438 mounted \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430     }   }<\/code><\/pre>\n<p>  \u0418 \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u044e\u0449\u0438\u0439 \u044d\u0442\u0430\u043f: \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0431\u0430\u0437\u043e\u0432\u044b\u0445 \u0441\u0442\u0438\u043b\u0435\u0439:<\/p>\n<pre><code class=\"javascript\">&lt;style lang=&quot;scss&quot; scoped&gt; .diagram {   width: 100%;   height: 100%;   position: absolute;   top: 0;   left: 0;   overflow: visible; } circle {   fill: transparent;   stroke: rgb(255, 255, 255);   stroke-width: 0.6px;   transform-origin: center;   transform: rotate(-90deg); \/* \u041e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u0432\u0435\u0440\u043d\u0451\u043c circle \u044d\u043b\u0435\u043c\u0435\u043d\u0442, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u0442\u0441\u0447\u0451\u0442 dasharray \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0447\u0438\u043d\u0430\u0442\u044c\u0441\u044f \u0441\u043f\u0440\u0430\u0432\u0430, \u0430 \u043d\u0435 \u0441\u0432\u0435\u0440\u0445\u0443. *\/   transition: stroke-dasharray 1s ease;     &amp;.front {     stroke: rgb(255, 255, 255);   } }   .satellite {   fill: #fff;   will-change: transform; \/\/ \u0441\u043a\u0430\u0436\u0435\u043c \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0443, \u0447\u0442\u043e \u043e\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044f \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u043d\u0430 GPU   stroke-width: 0.4px;   transition: transform 1s ease; } &lt;\/style&gt;<\/code><\/pre>\n<h3>\u0412\u044b\u0432\u043e\u0434\u044b<\/h3>\n<p>  \u0418\u0442\u0430\u043a, \u0435\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0432\u0438\u0434\u0435 \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u044b, \u0435\u0441\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u043f\u0443\u0442\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u044f. \u0414\u043b\u044f \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439 \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043a \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430\u043c (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <b>D3<\/b>), \u043d\u043e \u044d\u0442\u043e\u0442 \u0441\u043f\u043e\u0441\u043e\u0431 \u0437\u0430\u0447\u0430\u0441\u0442\u0443\u044e \u043f\u0440\u0438\u0432\u043d\u043e\u0441\u0438\u0442 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0440\u0438\u0441\u043a\u0438: \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0443\u0445\u0443\u0434\u0448\u0435\u043d\u0438\u0435 runtime \u0441\u0430\u0439\u0442\u0430 \u0438 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u0439 \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u043e\u0439 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438, \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435 time to Interactive \u0438 script execution, \u0430 \u043a\u0430\u043a \u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0435 \u2013 \u043d\u0435\u0434\u043e\u0432\u043e\u043b\u044c\u0441\u0442\u0432\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439. \u0415\u0441\u043b\u0438 \u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u044e\u0442\u0441\u044f, \u0442\u043e \u0431\u044b\u0432\u0430\u0435\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u2013 \u0438\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u043e\u0442 \u0441\u043f\u043e\u0441\u043e\u0431 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435. <\/p>\n<p>  \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043f\u043e\u043b\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0438 \u043f\u043e\u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c \u043c\u043e\u0436\u043d\u043e <a href=\"https:\/\/codesandbox.io\/s\/strange-kilby-u9umk?file=\/src\/components\/Diagram.vue\">\u0437\u0434\u0435\u0441\u044c<\/a>. <\/p>\n<p>  <b>\u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435! \u041d\u0430\u0434\u0435\u0435\u043c\u0441\u044f, \u0447\u0442\u043e \u044d\u0442\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u0431\u044b\u043b \u0432\u0430\u043c \u043f\u043e\u043b\u0435\u0437\u0435\u043d. <\/b><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/simbirsoft\/blog\/524220\/\"> https:\/\/habr.com\/ru\/company\/simbirsoft\/blog\/524220\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\u0411\u044b\u0432\u0430\u0435\u0442, \u0447\u0442\u043e \u043d\u0430 \u0441\u0430\u0439\u0442\u0435, \u0432 \u043a\u043e\u0440\u043f\u043e\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0439 IT-\u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0438\u043b\u0438 \u0434\u0440\u0443\u0433\u043e\u043c \u041f\u041e \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c \u043a\u0440\u0443\u0433\u043e\u0432\u044b\u0435 \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u044b \u0441 \u043a\u0430\u043a\u0438\u043c\u0438-\u043b\u0438\u0431\u043e \u0434\u0430\u043d\u043d\u044b\u043c\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0442\u0430\u0439\u043c\u0435\u0440 \u0434\u043b\u044f \u043e\u0442\u0441\u0447\u0435\u0442\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0438\u043b\u0438 \u0438\u043d\u0434\u0438\u043a\u0430\u0442\u043e\u0440, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u043e\u0432\u0430\u0440\u043e\u0432 \u043f\u0440\u043e\u0434\u0430\u043d\u043e \u0432 \u0442\u043e\u0439 \u0438\u043b\u0438 \u0438\u043d\u043e\u0439 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438. \u0415\u0441\u043b\u0438 \u044d\u0442\u043e \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \u0444\u043e\u0440\u043c\u0430\u0442\u043e\u043c svg, png \u0438\u043b\u0438 gif. \u041e\u0434\u043d\u0430\u043a\u043e, \u0437\u0430\u0447\u0430\u0441\u0442\u0443\u044e \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0434\u0438\u043d\u0430\u043c\u0438\u043a\u0435 \u2013 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430 \u0438\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u043b\u044f \u043f\u0440\u0438\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u044f \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439, \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043a\u0440\u0430\u0441\u0438\u0432\u043e\u0439 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438 \u043f\u0440\u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0435 \u0441\u0430\u0439\u0442\u0430. \u0414\u0435\u043b\u0438\u043c\u0441\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0443 \u0438\u0437 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 SVG \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e JS \u0438 CSS. <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/il\/9h\/3k\/il9h3kehvscsjwa9ftcje3jtwdu.png\"><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-311797","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/311797","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=311797"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/311797\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=311797"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=311797"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=311797"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}