首页 > 其他分享 >动态绘制svg

动态绘制svg

时间:2023-12-17 21:00:17浏览次数:31  
标签:svg app 4s stroke animation dashoffset line 动态 绘制

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #app {
            border: 1px solid red;
        }

        #app :nth-child(1) {
            stroke-dasharray: 359;
            stroke-dashoffset: 359;
            animation: line-w 4s ease 0.5s forwards;
            /* animation: name duration timing-function delay iteration-count direction fill-mode; */
        }

        #app :nth-child(2) {
            stroke-dasharray: 201;
            stroke-dashoffset: 201;
            animation: line-w 4s ease 4s forwards;
        }

        #app :nth-child(3) {
            stroke-dasharray: 1173;
            stroke-dashoffset: 1173;
            animation: line-w 4s ease 8s forwards;
        }

        #app path {
            transition: all 4s;
        }

        @keyframes line-w {
            to {
                stroke-dashoffset: 0;
            }
        }
    </style>
</head>

<body>
    <svg id="app" width="372" height="580" xmlns="http://www.w3.org/2000/svg">
        <path
            d="m55.5,164.453125c0,4 0.499031,5.953323 1,14c0.497101,7.984543 0.998062,15.906647 2,32c0.683514,10.978745 -0.640728,15.051651 0,19c1.013081,6.242889 2.420433,8.085815 3,10c1.04483,3.450851 2.538704,4.60643 5,6c3.587929,2.031448 8,1 9,1c2,0 5.587006,0.237259 11,-14c3.371437,-8.867554 6,-17 9,-29c1,-4 2.499382,-12.962601 3,-23c0.199257,-3.995041 0.851952,-6.228363 2,-9c0.541199,-1.306564 1,0 1,3c0,6 1.498291,13.937958 2,20c0.577362,6.976151 1.903397,19.016907 3,25c0.919258,5.015472 2.420433,16.085815 3,18c1.04483,3.450851 2.385094,6.372009 5,10c2.480713,3.441803 4.712006,5.981628 10,7c3.927826,0.756424 6.675446,2.324554 13,-4c3.162277,-3.162277 4.438614,-8.817596 8,-18c2.286987,-5.896591 2.080994,-9.10701 3,-13c1.027481,-4.352509 2.733063,-12.036285 3,-13c1.556473,-5.61937 3,-10 3,-11c0,-2 0,-5 0,-6c0,-2 -0.320358,-3.025818 0,-5c0.506546,-3.121445 1,-6 1,-7l0,-1l0,-1"
            id="svg_1" fill-opacity="null" stroke-opacity="null" stroke-width="6" stroke="#000" fill="none" />
        <path
            d="m272.5,144.453125c0,2 -0.197083,7.009735 0,9c0.502441,5.074203 1,10 1,16c0,5 0,11 0,16c0,4 0,14 0,16c0,4 0,7 0,13c0,9 -0.207397,12.953796 -1,17c-1.359283,6.939194 -2.75531,10.132004 -5,14c-1.809723,3.118484 -3.693451,4.458801 -5,5c-4.619385,1.913422 -9,0 -15,0c-11,0 -16.372009,0.614899 -20,-2c-4.589081,-3.307617 -5.917526,-7.056641 -8,-10c-2.887863,-4.081696 -6.458801,-8.693436 -7,-10c-0.765366,-1.847763 -2,-5 -3,-8c-1,-3 -1.917603,-5.386871 -3,-8c-0.38269,-0.923874 0,-5 -1,-7l-2,-4l0,-2"
            id="svg_2" fill-opacity="null" stroke-opacity="null" stroke-width="7" stroke="#000" fill="none" />
        <path stroke="#000" id="svg_3"
            d="m202.703677,142.129528l-71.056652,85.873722l70.178226,29.501695l-64.865124,92.192832l-26.188663,-15.568158l18.574702,88.86375l73.817669,-38.770715l-31.167005,-16.205975l84.632115,-132.418712l-77.363308,-23.999983l74.70679,-89.48177l-42.614172,-13.435222l46.413218,-56.870342l-17.050247,-0.817311l-72.024128,78.019999l34.006572,13.116214l0.000007,-0.000025z"
            fill-opacity="null" stroke-opacity="null" stroke-width="6" fill="none" />
        <ellipse filter="url(#svg_6_blur)" ry="9.5" rx="9.5" id="svg_6" cy="429.953125" cx="124" stroke-width="7"
            stroke="#aaffff" fill="#007fff" />
    </svg>
    <script>
        var wrap = document.querySelector('#app')
        var paths = wrap.querySelectorAll('path')
        paths.forEach((item, index) => {
            console.warn('item', item.getTotalLength())
        })
        // http://www.zuohaotu.com/svg/#move_front
    </script>
</body>

</html>

 

标签:svg,app,4s,stroke,animation,dashoffset,line,动态,绘制
From: https://www.cnblogs.com/justSmile2/p/17909796.html

相关文章

  • 非动态数组版本下的筛选
    问题:一对多查找(筛选)的结果需要横向排列,但是表格暂时不支持动态数组。右拉下拉公式解决:{=IFERROR(INDEX(FILTER($E:$E,$D:$D=$G2),COLUMN(A1)),"")}公式中的Filter部分筛选出满总D列中等产于G2对应E列的内容,其结果是多个单元格组成的数组。使用Index提取数组中的内容,第......
  • VUE框架指令语法与v-bind实现标签属性内部动态------VUE框架
    <!DOCTYPEhtml><htmllang="en"><head><metacharset="UTF-8"><metaname="viewport"content="width=device-width,initial-scale=1.0"><title>Document</title>......
  • Threejs利用着色器编写动态飞线特效
    一、导语动态飞线特效是可视化数据地图中常见的需求之一,鼠标点击的区块作为终点,从其他区块飞线至点击区块,附带颜色变换或者结合粒子动画二、分析利用创建3点来构成贝塞尔曲线,形成线段利用着色器材质来按照线段以及时间点变化来变化线段的颜色形成动画三、上基础代码//贝塞尔曲线......
  • 免杀-绕过静态动态查杀
    前言在我们后渗透时很多时候需要使用到一些敏感的工具,而这些工具大多都被360等杀软厂商标记。导致我们传入的工具无法执行或执行时被拦截。接下来以测试工具mimitakz为例演示如何绕过这些杀软拦截,躲避查杀等。以下为具体开发细节,程序执行时杀软拦截360静态查杀何为"静态查......
  • Highcharts 用SVGRenderer方法点击鼠标移动光标​
    需求演示如何使用SVGRenderer方法来实现点击鼠标移动光标,并解释说明属性功能。分析使用SVGRenderer方法来实现点击鼠标移动光标,可以按照以下步骤进行操作:创建SVGRenderer实例:首先,你需要创建一个SVGRenderer实例,用于渲染SVG元素和操作SVG属性。设置SVG元素属性:使用SVGRenderer的方法......
  • Golang 配置文件动态更变(viper)
    一.下载包gogetgithub.com/spf13/viper二.源码1funcLoadConf(fpnamestring){2ini:=viper.New()3ini.SetConfigFile(fpname)45ini.SetDefault("database.dbname","esaletest")6ini.SetDefault("database.dbhos......
  • 【笔记】2023.12.16 动态规划
    笔记2023.12.16:动态规划今天题目很多,可能有些题不口胡了。LOJ6089小Y的背包计数问题前\(\sqrtn\)个物品直接做单调队列优化是\(O(n\sqrtn)\)。大于\(\sqrtn\)的是完全背包。考虑到完全背包\(v\)的OGF为\(\dfrac{1}{1-x^{v}}\)。这不行。你考虑到对于一个物......
  • MongoDB 7.0 动态 WiredTiger tickets
    在WiredTiger存储引擎中,WiredTigertickets提供了并发控制机制。这些tickets分为读tickets和写tickets。当多个操作,比如读和写尝试并发访问数据库,WiredTiger使用tickets来确保这些操作不会冲突,从而保证数据的完整性和性能。WiredTiger中的"tickets"实际上是一种资源管理机制,用于限......
  • html+js实现数字自动动态增长
    animationnumber函数的参数可以是数组也可以是单个字符串,但是必须是数组中的元素是数字类型HTML部分<div class="content-boxs">    <div class="row-price">        <div class="price-box">            <p id="totalPrice" data-value="......
  • Highcharts 用SVGRenderer方法使柱状图连接列边​
    需求在Highcharts中,可以使用SVGRenderer方法来创建路径连接柱状图的列边,并根据具体的数据和需求进行适当的调整和扩展。分析要使用Highcharts的SVGRenderer方法来绘制柱状图并连接列边,可以按照以下步骤进行操作:创建柱状图:使用Highcharts的 chart 方法创建一个柱状图,并......