I can't animate line. Why? Pls help | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
17th Nov 2020, 7:50 AM
UTKARSH
UTKARSH - avatar
2 Answers
+ 3
The animate element should be contained by "line" element, the same way you did with "rect" element. Before: <animate ... /> <line ...> </line> After: <line ...> <animate ... /> </line> Then: There's no attribute called "y" in "line" element. You are likely going to need to animate "y1" and "y2" separately.
17th Nov 2020, 8:21 AM
Kevin ★
+ 1
You should do like this : <svg width="500" height="600"> <line x1="50" y1="50" x2="100" y2="100" style="stroke:#000000; stroke-width:20"> <animate attributeName="y1" from="50" to="300" dur="3s" fill="freeze" repeatCount="10"/> </line> </svg> hope it helps.
18th Nov 2020, 4:17 AM
Shaili Shah
Shaili Shah - avatar