SVG路径颜色动画

huangapple go评论61阅读模式
英文:

Animate SVG path color

问题

I have an app that creates animations based on SVG files. During the animation of "paths," the color is black, but my color fill="#e67700". How can I fix that?

原始路径如有必要:

<g transform="translate(10 306.9962735735079) rotate(0 267.00513705514027 -148.49813678675395)" stroke="none">
    <path fill="#e67700" d="M -3.11,-5.41 Q -3.11,-5.41 9.63,-12.60 22.38,-19.79 32.35,-25.25 42.32,-30.71 51.46,-35.65 60.60,-40.59 72.50,-47.42 84.41,-54.24 97.54,-61.45 110.67,-68.65 123.18,-75.94 135.69,-83.23 149.83,-92.20 163.96,-101.16 178.85,-110.89 193.73,-120.61 207.13,-129.93 220.53,-139.25 233.19,-147.41 245.85,-155.56 264.37,-166.14 282.90,-176.72 307.28,-190.80 331.66,-204.89 349.58,-214.66 367.51,-224.43 394.65,-236.71 421.79,-248.99 444.46,-260.27 467.13,-271.56 481.37,-278.78 495.60,-286.00 505.06,-290.23 514.51,-294.45 518.94,-297.01 523.37,-299.56 527.32,-301.81 531.26,-304.06 532.47,-304.32 533.67,-304.57 534.88,-304.42 536.10,-304.28 537.21,-303.75 538.32,-303.23 539.20,-302.38 540.09,-301.52 540.65,-300.43 541.21,-299.34 541.40,-298.13 541.59,-296.92 541.38,-295.71 541.17,-294.50 540.58,-293.42 540.00,-292.34 539.10,-291.51 538.20,-290.67 537.08,-290.17 535.96,-289.66 534.74,-289.54 533.52,-289.42 532.33,-289.70 531.13,-289.97 530.09,-290.62 529.04,-291.26 528.26,-292.20 527.47,-293.14 527.03,-294.29 526.58,-295.43 526.53,-296.66 526.47,-297.88 526.81,-299.06 527.15,-300.24 527.85,-301.25 528.55,-302.26 529.53,-302.99 530.52,-303.73 531.68,-304.11 532.85,-304.49 534.08,-304.47 535.30,-304.46 536.46,-304.06 537.62,-303.66 538.59,-302.91 539.56,-302.15 540.24,-301.13 540.92,-300.11 541.24,-298.92 541.55,-297.74 541.47,-296.51 541.40,-295.29 540.93,-294.15 540.47,-293.02 539.66,-292.09 538.86,-291.16 537.80,-290.54 536.74,-289.92 536.74,-289.92 536.75,-289.92 532.64,-289.05 528.54,-288.18 523.67,-286.51 518.80,-284.85 509.58,-280.73 500.36,-276.62 486.09,-269.38 471.82,-262.14 448.97,-250.77 426.12,-239.40 399.34,-227.29 372.55,-215.18 354.74,-205.47 336.94,-195.76 312.54,-181.65 288.14,-167.54 269.86,-157.11 251.58,-146.67 239.09,-138.60 226.60,-130.54 213.09,-121.11 199.57,-111.69 184.64,-101.90 169.71,-92.12 155.43,-83.01 141.15,-73.91 128.54,-66.51 115.94,-59.10 102.94,-51.88 89.94,-44.66 77.99,-37.69 66.03,-30.72 56.99,-25.67 47.96,-20.62 38.15,-15.02 28.35,-9.43 15.73,-2.01 3.11,5.41 2.42,5.70 1.73,6.00 0.98,6.12 0.24,6.24 -0.50,6.18 -1.25,6.12 -1.96,5.88 -2.68,5.64 -3.32,5.23 -3.95,4.83 -4.47,4.29 -4.99,3.74 -5.37,3.09 -5.75,2.44 -5.95,1.72 -6.16,0.99 -6.19,0.24 -6.22,-0.50 -6.07,-1.24 -5.92,-1.98 -5.60,-2.66 -5.27,-3.34 -4.80,-3.92 -4.32,-4.51 -3.72,-4.96 -3.11,-5.41 -3.11,-5.41 L -3.11,-5.41 Z"></path>
</g>

你可以在这里看到问题:https://jsfiddle.net/mawb/k6guznyp/10/

英文:

I have an app that create animations based on SVG files..
During the animation of "paths".. the color is black but my color fill=&quot;#e67700&quot;
how can i fix that?

&lt;svg version=&quot;1.1&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot; viewBox=&quot;0 0 1338.9181636059818 623.2810362298012&quot;
width=&quot;2677.8363272119636&quot; height=&quot;1246.5620724596024&quot; id=&quot;scene0&quot; style=&quot;display: none;&quot;&gt;
&lt;g transform=&quot;translate(10 306.9962735735079) rotate(0 267.00513705514027 -148.49813678675395)&quot; stroke=&quot;none&quot;&gt;
&lt;path fill=&quot;#e67700&quot;
d=&quot;M -3.11,-5.41 Q -3.11,-5.41 9.63,-12.60 22.38,-19.79 32.35,-25.25 42.32,-30.71 51.46,-35.65 60.60,-40.59 72.50,-47.42 84.41,-54.24 97.54,-61.45 110.67,-68.65 123.18,-75.94 135.69,-83.23 149.83,-92.20 163.96,-101.16 178.85,-110.89 193.73,-120.61 207.13,-129.93 220.53,-139.25 233.19,-147.41 245.85,-155.56 264.37,-166.14 282.90,-176.72 307.28,-190.80 331.66,-204.89 349.58,-214.66 367.51,-224.43 394.65,-236.71 421.79,-248.99 444.46,-260.27 467.13,-271.56 481.37,-278.78 495.60,-286.00 505.06,-290.23 514.51,-294.45 518.94,-297.01 523.37,-299.56 526.76,-301.10 530.14,-302.64 531.20,-302.86 532.25,-303.08 533.32,-302.96 534.39,-302.83 535.37,-302.37 536.34,-301.91 537.12,-301.16 537.89,-300.41 538.39,-299.45 538.88,-298.49 539.05,-297.43 539.21,-296.36 539.03,-295.30 538.84,-294.24 538.33,-293.29 537.82,-292.35 537.03,-291.61 536.24,-290.88 535.25,-290.44 534.27,-289.99 533.20,-289.89 532.13,-289.78 531.08,-290.02 530.03,-290.26 529.11,-290.83 528.19,-291.39 527.50,-292.22 526.81,-293.05 526.42,-294.05 526.03,-295.06 525.98,-296.13 525.94,-297.21 526.23,-298.25 526.53,-299.28 527.15,-300.17 527.76,-301.05 528.62,-301.70 529.49,-302.34 530.51,-302.68 531.54,-303.01 532.61,-303.00 533.69,-302.99 534.71,-302.64 535.73,-302.28 536.58,-301.62 537.43,-300.96 538.03,-300.06 538.62,-299.17 538.90,-298.12 539.18,-297.08 539.11,-296.01 539.04,-294.93 538.63,-293.94 538.22,-292.94 537.52,-292.12 536.81,-291.31 535.88,-290.76 534.96,-290.22 534.96,-290.22 534.96,-290.22 531.75,-289.20 528.54,-288.18 523.67,-286.51 518.80,-284.85 509.58,-280.73 500.36,-276.62 486.09,-269.38 471.82,-262.14 448.97,-250.77 426.12,-239.40 399.34,-227.29 372.55,-215.18 354.74,-205.47 336.94,-195.76 312.54,-181.65 288.14,-167.54 269.86,-157.11 251.58,-146.67 239.09,-138.60 226.60,-130.54 213.09,-121.11 199.57,-111.69 184.64,-101.90 169.71,-92.12 155.43,-83.01 141.15,-73.91 128.54,-66.51 115.94,-59.10 102.94,-51.88 89.94,-44.66 77.99,-37.69 66.03,-30.72 56.99,-25.67 47.96,-20.62 38.15,-15.02 28.35,-9.43 15.73,-2.01 3.11,5.41 2.42,5.70 1.73,6.00 0.98,6.12 0.24,6.24 -0.50,6.18 -1.25,6.12 -1.96,5.88 -2.68,5.64 -3.32,5.23 -3.95,4.83 -4.47,4.29 -4.99,3.74 -5.37,3.09 -5.75,2.44 -5.95,1.72 -6.16,0.99 -6.19,0.24 -6.22,-0.50 -6.07,-1.24 -5.92,-1.98 -5.60,-2.66 -5.27,-3.34 -4.80,-3.92 -4.32,-4.51 -3.72,-4.96 -3.11,-5.41 -3.11,-5.41 L -3.11,-5.41 Z&quot;
opacity=&quot;0&quot;&gt;
&lt;animate attributeName=&quot;opacity&quot; from=&quot;0&quot; to=&quot;1&quot; calcMode=&quot;discrete&quot; begin=&quot;2999ms&quot; dur=&quot;1ms&quot; fill=&quot;freeze&quot;&gt;
&lt;/animate&gt;
&lt;/path&gt;
&lt;path&gt;
&lt;animate attributeName=&quot;d&quot;
from=&quot;M -3.11,-5.41 Q -3.11,-5.41 9.63,-12.60 22.38,-19.79 32.35,-25.25 42.32,-30.71 51.46,-35.65 60.60,-40.59 72.50,-47.42 84.41,-54.24 97.54,-61.45 110.67,-68.65 123.18,-75.94 135.69,-83.23 149.83,-92.20 163.96,-101.16 178.85,-110.89 193.73,-120.61 207.13,-129.93 220.53,-139.25 233.19,-147.41 245.85,-155.56 264.37,-166.14 282.90,-176.72 307.28,-190.80 331.66,-204.89 349.58,-214.66 367.51,-224.43 394.65,-236.71 421.79,-248.99 444.46,-260.27 467.13,-271.56 481.37,-278.78 495.60,-286.00 505.06,-290.23 514.51,-294.45 518.94,-297.01 523.37,-299.56 527.40,-301.60 531.43,-303.64 532.56,-303.87 533.69,-304.11 534.83,-303.98 535.98,-303.84 537.02,-303.35 538.06,-302.85 538.89,-302.05 539.72,-301.25 540.25,-300.23 540.78,-299.20 540.96,-298.06 541.13,-296.92 540.93,-295.79 540.74,-294.65 540.19,-293.64 539.64,-292.62 538.79,-291.84 537.95,-291.05 536.90,-290.58 535.85,-290.11 534.70,-289.99 533.55,-289.88 532.43,-290.14 531.30,-290.40 530.32,-291.00 529.34,-291.60 528.60,-292.49 527.86,-293.38 527.45,-294.45 527.03,-295.53 526.98,-296.68 526.93,-297.83 527.25,-298.94 527.57,-300.05 528.22,-300.99 528.88,-301.94 529.80,-302.63 530.73,-303.32 531.82,-303.68 532.92,-304.04 534.07,-304.02 535.23,-304.01 536.32,-303.63 537.40,-303.26 538.32,-302.55 539.23,-301.84 539.86,-300.88 540.50,-299.92 540.80,-298.81 541.10,-297.69 541.02,-296.54 540.95,-295.39 540.51,-294.32 540.08,-293.26 539.32,-292.39 538.57,-291.51 537.57,-290.93 536.58,-290.34 536.58,-290.35 536.58,-290.35 532.56,-289.26 528.54,-288.18 523.67,-286.51 518.80,-284.85 509.58,-280.73 500.36,-276.62 486.09,-269.38 471.82,-262.14 448.97,-250.77 426.12,-239.40 399.34,-227.29 372.55,-215.18 354.74,-205.47 336.94,-195.76 312.54,-181.65 288.14,-167.54 269.86,-157.11 251.58,-146.67 239.09,-138.60 226.60,-130.54 213.09,-121.11 199.57,-111.69 184.64,-101.90 169.71,-92.12 155.43,-83.01 141.15,-73.91 128.54,-66.51 115.94,-59.10 102.94,-51.88 89.94,-44.66 77.99,-37.69 66.03,-30.72 56.99,-25.67 47.96,-20.62 38.15,-15.02 28.35,-9.43 15.73,-2.01 3.11,5.41 2.42,5.70 1.73,6.00 0.98,6.12 0.24,6.24 -0.50,6.18 -1.25,6.12 -1.96,5.88 -2.68,5.64 -3.32,5.23 -3.95,4.83 -4.47,4.29 -4.99,3.74 -5.37,3.09 -5.75,2.44 -5.95,1.72 -6.16,0.99 -6.19,0.24 -6.22,-0.50 -6.07,-1.24 -5.92,-1.98 -5.60,-2.66 -5.27,-3.34 -4.80,-3.92 -4.32,-4.51 -3.72,-4.96 -3.11,-5.41 -3.11,-5.41 L -3.11,-5.41 Z&quot;
to=&quot;M -3.11,-5.41 Q -3.11,-5.41 9.63,-12.60 22.38,-19.79 32.35,-25.25 42.32,-30.71 51.46,-35.65 60.60,-40.59 72.50,-47.42 84.41,-54.24 97.54,-61.45 110.67,-68.65 123.18,-75.94 135.69,-83.23 149.83,-92.20 163.96,-101.16 178.85,-110.89 193.73,-120.61 207.13,-129.93 220.53,-139.25 233.19,-147.41 245.85,-155.56 264.37,-166.14 282.90,-176.72 307.28,-190.80 331.66,-204.89 349.58,-214.66 367.51,-224.43 394.65,-236.71 421.79,-248.99 444.46,-260.27 467.13,-271.56 481.37,-278.78 495.60,-286.00 505.06,-290.23 514.51,-294.45 518.94,-297.01 523.37,-299.56 526.76,-301.10 530.14,-302.64 531.20,-302.86 532.25,-303.08 533.32,-302.96 534.39,-302.83 535.37,-302.37 536.34,-301.91 537.12,-301.16 537.89,-300.41 538.39,-299.45 538.88,-298.49 539.05,-297.43 539.21,-296.36 539.03,-295.30 538.84,-294.24 538.33,-293.29 537.82,-292.35 537.03,-291.61 536.24,-290.88 535.25,-290.44 534.27,-289.99 533.20,-289.89 532.13,-289.78 531.08,-290.02 530.03,-290.26 529.11,-290.83 528.19,-291.39 527.50,-292.22 526.81,-293.05 526.42,-294.05 526.03,-295.06 525.98,-296.13 525.94,-297.21 526.23,-298.25 526.53,-299.28 527.15,-300.17 527.76,-301.05 528.62,-301.70 529.49,-302.34 530.51,-302.68 531.54,-303.01 532.61,-303.00 533.69,-302.99 534.71,-302.64 535.73,-302.28 536.58,-301.62 537.43,-300.96 538.03,-300.06 538.62,-299.17 538.90,-298.12 539.18,-297.08 539.11,-296.01 539.04,-294.93 538.63,-293.94 538.22,-292.94 537.52,-292.12 536.81,-291.31 535.88,-290.76 534.96,-290.22 534.96,-290.22 534.96,-290.22 531.75,-289.20 528.54,-288.18 523.67,-286.51 518.80,-284.85 509.58,-280.73 500.36,-276.62 486.09,-269.38 471.82,-262.14 448.97,-250.77 426.12,-239.40 399.34,-227.29 372.55,-215.18 354.74,-205.47 336.94,-195.76 312.54,-181.65 288.14,-167.54 269.86,-157.11 251.58,-146.67 239.09,-138.60 226.60,-130.54 213.09,-121.11 199.57,-111.69 184.64,-101.90 169.71,-92.12 155.43,-83.01 141.15,-73.91 128.54,-66.51 115.94,-59.10 102.94,-51.88 89.94,-44.66 77.99,-37.69 66.03,-30.72 56.99,-25.67 47.96,-20.62 38.15,-15.02 28.35,-9.43 15.73,-2.01 3.11,5.41 2.42,5.70 1.73,6.00 0.98,6.12 0.24,6.24 -0.50,6.18 -1.25,6.12 -1.96,5.88 -2.68,5.64 -3.32,5.23 -3.95,4.83 -4.47,4.29 -4.99,3.74 -5.37,3.09 -5.75,2.44 -5.95,1.72 -6.16,0.99 -6.19,0.24 -6.22,-0.50 -6.07,-1.24 -5.92,-1.98 -5.60,-2.66 -5.27,-3.34 -4.80,-3.92 -4.32,-4.51 -3.72,-4.96 -3.11,-5.41 -3.11,-5.41 L -3.11,-5.41 Z&quot;
begin=&quot;2904.7619047619046ms&quot; dur=&quot;95.23809523809524ms&quot;&gt;&lt;/animate&gt;
&lt;/path&gt;
....
&lt;/g&gt;
&lt;/svg&gt;

the original path if necessary :

&lt;g transform=&quot;translate(10 306.9962735735079) rotate(0 267.00513705514027 -148.49813678675395)&quot; stroke=&quot;none&quot;&gt;&lt;path fill=&quot;#e67700&quot; d=&quot;M -3.11,-5.41 Q -3.11,-5.41 9.63,-12.60 22.38,-19.79 32.35,-25.25 42.32,-30.71 51.46,-35.65 60.60,-40.59 72.50,-47.42 84.41,-54.24 97.54,-61.45 110.67,-68.65 123.18,-75.94 135.69,-83.23 149.83,-92.20 163.96,-101.16 178.85,-110.89 193.73,-120.61 207.13,-129.93 220.53,-139.25 233.19,-147.41 245.85,-155.56 264.37,-166.14 282.90,-176.72 307.28,-190.80 331.66,-204.89 349.58,-214.66 367.51,-224.43 394.65,-236.71 421.79,-248.99 444.46,-260.27 467.13,-271.56 481.37,-278.78 495.60,-286.00 505.06,-290.23 514.51,-294.45 518.94,-297.01 523.37,-299.56 527.32,-301.81 531.26,-304.06 532.47,-304.32 533.67,-304.57 534.88,-304.42 536.10,-304.28 537.21,-303.75 538.32,-303.23 539.20,-302.38 540.09,-301.52 540.65,-300.43 541.21,-299.34 541.40,-298.13 541.59,-296.92 541.38,-295.71 541.17,-294.50 540.58,-293.42 540.00,-292.34 539.10,-291.51 538.20,-290.67 537.08,-290.17 535.96,-289.66 534.74,-289.54 533.52,-289.42 532.33,-289.70 531.13,-289.97 530.09,-290.62 529.04,-291.26 528.26,-292.20 527.47,-293.14 527.03,-294.29 526.58,-295.43 526.53,-296.66 526.47,-297.88 526.81,-299.06 527.15,-300.24 527.85,-301.25 528.55,-302.26 529.53,-302.99 530.52,-303.73 531.68,-304.11 532.85,-304.49 534.08,-304.47 535.30,-304.46 536.46,-304.06 537.62,-303.66 538.59,-302.91 539.56,-302.15 540.24,-301.13 540.92,-300.11 541.24,-298.92 541.55,-297.74 541.47,-296.51 541.40,-295.29 540.93,-294.15 540.47,-293.02 539.66,-292.09 538.86,-291.16 537.80,-290.54 536.74,-289.92 536.74,-289.92 536.75,-289.92 532.64,-289.05 528.54,-288.18 523.67,-286.51 518.80,-284.85 509.58,-280.73 500.36,-276.62 486.09,-269.38 471.82,-262.14 448.97,-250.77 426.12,-239.40 399.34,-227.29 372.55,-215.18 354.74,-205.47 336.94,-195.76 312.54,-181.65 288.14,-167.54 269.86,-157.11 251.58,-146.67 239.09,-138.60 226.60,-130.54 213.09,-121.11 199.57,-111.69 184.64,-101.90 169.71,-92.12 155.43,-83.01 141.15,-73.91 128.54,-66.51 115.94,-59.10 102.94,-51.88 89.94,-44.66 77.99,-37.69 66.03,-30.72 56.99,-25.67 47.96,-20.62 38.15,-15.02 28.35,-9.43 15.73,-2.01 3.11,5.41 2.42,5.70 1.73,6.00 0.98,6.12 0.24,6.24 -0.50,6.18 -1.25,6.12 -1.96,5.88 -2.68,5.64 -3.32,5.23 -3.95,4.83 -4.47,4.29 -4.99,3.74 -5.37,3.09 -5.75,2.44 -5.95,1.72 -6.16,0.99 -6.19,0.24 -6.22,-0.50 -6.07,-1.24 -5.92,-1.98 -5.60,-2.66 -5.27,-3.34 -4.80,-3.92 -4.32,-4.51 -3.72,-4.96 -3.11,-5.41 -3.11,-5.41 L -3.11,-5.41 Z&quot;&gt;&lt;/path&gt;&lt;/g&gt;

you can see the problem here: https://jsfiddle.net/mawb/k6guznyp/10/

答案1

得分: 1

在每个路径元素中添加"fill"属性。

<svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 338.9181636059818 323.2810362298012" width="477.8363272119636" height="246.5620724596024" id="scene0" style="display: none;">
  <g transform="translate(10 306.9962735735079) rotate(0 267.00513705514027 -148.49813678675395)" stroke="none">
    <path fill="#e67700"
      d="M -3.11,-5.41 Q -3.11,-5.41 9.63,-12.60 22.38,-19.79 32.35,-25.25 42.32,-30.71 51.46,-35.65 60.60,-40.59 72.50,-47.42 84.41,-54.24 97.54,-61.45 110.67,-68.65 123.18,-75.94 135.69,-83.23 149.83,-92.20 163.96,-101.16 178.85,-110.89 193.73,-120.61 207.13,-129.93 220.53,-139.25 233.19,-147.41 245.85,-155.56 264.37,-166.14 282.90,-176.72 307.28,-190.80 331.66,-204.89 349.58,-214.66 367.51,-224.43 394.65,-236.71 421.79,-248.99 444.46,-260.27 467.13,-271.56 481.37,-278.78 495.60,-286.00 505.06,-290.23 514.51,-294.45 518.94,-297.01 523.37,-299.56 526.76,-301.10 530.14,-302.64 531.20,-302.86 532.25,-303.08 533.32,-302.96 534.39,-302.83 535.37,-302.37 536.34,-301.91 537.12,-301.16 537.89,-300.41 538.39,-299.45 538.88,-298.49 539.05,-297.43 539.21,-296.36 539.03,-295.30 538.84,-294.24 538.33,-293.29 537.82,-292.35 537.03,-291.61 536.24,-290.88 535.25,-290.44 534.27,-289.99 533.20,-289.89 532.13,-289.78 531.08,-290.02 530.03,-290.26 529.11,-290.83 528.19,-291.39 527.50,-292.22 526.81,-293.05 526.42,-294.05 526.03,-295.06 525.98,-296.13 525.94,-297.21 526.23,-298.25 526.53,-299.28 527.15,-300.17 527.76,-301.05 528.62,-301.70 529.49,-302.34 530.51,-302.68 531.54,-303.01 532.61,-303.00 533.69,-302.99 534.71,-302.64 535.73,-302.28 536.58,-301.62 537.43,-300.96 538.03,-300.06 538.62,-299.17 538.90,-298.12 539.18,-297.08 539.11,-296.01 539.04,-294.93 538.63,-293.94 538.22,-292.94 537.52,-292.12 536.81,-291.31 535.88,-290.76 534.96,-290.22 534.96,-290.22 534.96,-290.22 531.75,-289.20 528.54,-288.18 523.67,-286.51 518.80,-284.85 509.58,-280.73 500.36,-276.62 486.09,-269.38 471.82,-262.14 448.97,-250.77 426.12,-239.40 399.34,-227.29 372.55,-215.18 354.74,-205.47 336.94,-195.76 312.54,-181.65 288.14,-167.54 269.86,-157.11 251.58,-146.67 239.09,-138.60 226.60,-130.54 213.09,-121.11 199.57,-111.69 184.64,-101.90 169.71,-92.12 155.43,-83.01 141.15,-73.91 128.54,-66.51 115.94,-59.10 102.94,-51.88 89.94,-44.66 77.99,-37.69 66.03,-30.72 56.99,-25.67 47.96,-20.62 38.15,-15.02 28.35,-9.43 15.73,-2.01 3.11,5.41 2.42,5.70 1.73,6.00 0.98,6.12 0.24,6.24 -0.50,6.18 -1.25,6.12 -1.96,5.88 -2.68,5.64 -3.32,5.23 -3.95,4.83 -4.47,4.29 -4.99,3.74 -5.37,3.09 -5.75,2.44 -5.95,1.72 -6.16,0.99 -6.19,0.24 -6.22,-0.50 -6.07,-1.24 -5.92,-1.98 -5.60,-2.66 -5.27,-3.34 -4.80,-3.92 -4.32,-4.51 -3.72,-4.96 -3.11,-5.41 -3.11,-5.41 L -3.11,-5.41 Z"
      opacity="0">
      <animate attributeName="opacity" from="0" to="1" calcMode="discrete" begin="2999ms" dur="1ms" fill="freeze"></animate>
    </path>
  </g>
</svg>
英文:

Add fill atrribute in every path elements.

&lt;!DOCTYPE html&gt;
&lt;html lang=&quot;en&quot;&gt;
&lt;script&gt;
let index = 0;
let totalScenes = 1
document.addEventListener(&#39;DOMContentLoaded&#39;, () =&gt; {
document.getElementById(&#39;scene&#39; + index).style.display = &#39;block&#39;;
document.getElementById(&#39;scene&#39; + index).setCurrentTime(0);
});
&lt;/script&gt;
&lt;body&gt;
&lt;div id=&quot;container&quot;&gt;
&lt;div id=&quot;slides&quot;&gt;
&lt;svg version=&quot;1.1&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot; viewBox=&quot;0 0 338.9181636059818 323.2810362298012&quot;
width=&quot;477.8363272119636&quot; height=&quot;246.5620724596024&quot; id=&quot;scene0&quot; style=&quot;display: none;&quot;&gt;
&lt;g transform=&quot;translate(10 306.9962735735079) rotate(0 267.00513705514027 -148.49813678675395)&quot; stroke=&quot;none&quot;&gt;
&lt;path fill=&quot;#e67700&quot;
d=&quot;M -3.11,-5.41 Q -3.11,-5.41 9.63,-12.60 22.38,-19.79 32.35,-25.25 42.32,-30.71 51.46,-35.65 60.60,-40.59 72.50,-47.42 84.41,-54.24 97.54,-61.45 110.67,-68.65 123.18,-75.94 135.69,-83.23 149.83,-92.20 163.96,-101.16 178.85,-110.89 193.73,-120.61 207.13,-129.93 220.53,-139.25 233.19,-147.41 245.85,-155.56 264.37,-166.14 282.90,-176.72 307.28,-190.80 331.66,-204.89 349.58,-214.66 367.51,-224.43 394.65,-236.71 421.79,-248.99 444.46,-260.27 467.13,-271.56 481.37,-278.78 495.60,-286.00 505.06,-290.23 514.51,-294.45 518.94,-297.01 523.37,-299.56 526.76,-301.10 530.14,-302.64 531.20,-302.86 532.25,-303.08 533.32,-302.96 534.39,-302.83 535.37,-302.37 536.34,-301.91 537.12,-301.16 537.89,-300.41 538.39,-299.45 538.88,-298.49 539.05,-297.43 539.21,-296.36 539.03,-295.30 538.84,-294.24 538.33,-293.29 537.82,-292.35 537.03,-291.61 536.24,-290.88 535.25,-290.44 534.27,-289.99 533.20,-289.89 532.13,-289.78 531.08,-290.02 530.03,-290.26 529.11,-290.83 528.19,-291.39 527.50,-292.22 526.81,-293.05 526.42,-294.05 526.03,-295.06 525.98,-296.13 525.94,-297.21 526.23,-298.25 526.53,-299.28 527.15,-300.17 527.76,-301.05 528.62,-301.70 529.49,-302.34 530.51,-302.68 531.54,-303.01 532.61,-303.00 533.69,-302.99 534.71,-302.64 535.73,-302.28 536.58,-301.62 537.43,-300.96 538.03,-300.06 538.62,-299.17 538.90,-298.12 539.18,-297.08 539.11,-296.01 539.04,-294.93 538.63,-293.94 538.22,-292.94 537.52,-292.12 536.81,-291.31 535.88,-290.76 534.96,-290.22 534.96,-290.22 534.96,-290.22 531.75,-289.20 528.54,-288.18 523.67,-286.51 518.80,-284.85 509.58,-280.73 500.36,-276.62 486.09,-269.38 471.82,-262.14 448.97,-250.77 426.12,-239.40 399.34,-227.29 372.55,-215.18 354.74,-205.47 336.94,-195.76 312.54,-181.65 288.14,-167.54 269.86,-157.11 251.58,-146.67 239.09,-138.60 226.60,-130.54 213.09,-121.11 199.57,-111.69 184.64,-101.90 169.71,-92.12 155.43,-83.01 141.15,-73.91 128.54,-66.51 115.94,-59.10 102.94,-51.88 89.94,-44.66 77.99,-37.69 66.03,-30.72 56.99,-25.67 47.96,-20.62 38.15,-15.02 28.35,-9.43 15.73,-2.01 3.11,5.41 2.42,5.70 1.73,6.00 0.98,6.12 0.24,6.24 -0.50,6.18 -1.25,6.12 -1.96,5.88 -2.68,5.64 -3.32,5.23 -3.95,4.83 -4.47,4.29 -4.99,3.74 -5.37,3.09 -5.75,2.44 -5.95,1.72 -6.16,0.99 -6.19,0.24 -6.22,-0.50 -6.07,-1.24 -5.92,-1.98 -5.60,-2.66 -5.27,-3.34 -4.80,-3.92 -4.32,-4.51 -3.72,-4.96 -3.11,-5.41 -3.11,-5.41 L -3.11,-5.41 Z&quot;
opacity=&quot;0&quot;&gt;
&lt;animate attributeName=&quot;opacity&quot; from=&quot;0&quot; to=&quot;1&quot; calcMode=&quot;discrete&quot; begin=&quot;2999ms&quot; dur=&quot;1ms&quot; fill=&quot;freeze&quot;&gt;
&lt;/animate&gt;
&lt;/path&gt;
&lt;/g&gt;
&lt;/svg&gt;
&lt;/div&gt;
&lt;/div&gt; 
&lt;/body&gt;
&lt;/html&gt;

Check demo here
https://www.codesprogram.com/snippet/wYPlsp

答案2

得分: 0

由于我无法编辑路径元素,我在&lt;animate attributeName=&quot;d&quot;...下方添加了一个新的属性:

&lt;animate attributeName=&quot;fill&quot; values=&quot;#e67700&quot;&gt;&lt;/animate&gt;
英文:

Since i can't edit the path elements, i added a new Attribute below &lt;animate attributeName=&quot;d&quot;...:

&lt;animate attributeName=&quot;fill&quot; values=&quot;#e67700&quot;&gt;&lt;/animate&gt;

huangapple
  • 本文由 发表于 2023年2月6日 05:09:05
  • 转载请务必保留本文链接:https://go.coder-hub.com/75355521.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定