+ 3

Can i get more than 1 SVG image to animateMotion?

I tried 2 it's only running the first ignoring the second is there a tag that can help or something?

24th Oct 2017, 8:25 PM
bobbie
bobbie - avatar
9 Answers
+ 5
Along with checking <defs> element, take a look to <g> (group) and <symbol> elements: they are both also a usefull way of grouping elements, with each some specificities ;)
25th Oct 2017, 11:30 AM
visph
visph - avatar
+ 7
If by "svg image" you are meaning "svg element", yes you can... but refering to this code found in your playground profil: https://code.sololearn.com/WUh6xc4RgJnt/?ref=app#html ... you need to correctly build your <svg> by correctly closing it (or them, you can have more than once <svg> element in a html document) and not mixing html and svg element inside ^^ In addition, <animateMotion> element is designed to use path as track for movement: you better need a simple <animation> element to do a linear movement... Anyway, in all case, you can use and refer to a same <path> object element id in many <animateMotion> element by using 'mpath' attribute rather than the 'path' defining one: check also use of <defs> element to define not initially shown svg elements than you can use many time elsewhere ;)
25th Oct 2017, 7:08 AM
visph
visph - avatar
+ 3
Correct write is </rect> and </polygon>... not <\rect> and <\polygon> ^^ And need to correctly close tags was already pointed in my first post ;P
25th Oct 2017, 3:35 PM
visph
visph - avatar
+ 2
Thank you visph!!! This is still very new to me. I am trying to get multiple planes in the sky moving above the device motion one and move buildings as a unit with the rectangle body and polygon roof. Hopefully I can now accomplish this with your advice. I appreciate the help!!!
25th Oct 2017, 11:27 AM
bobbie
bobbie - avatar
+ 1
Sí Raynier , ¿qué uso para que sea inherente?
25th Oct 2017, 1:03 AM
bobbie
bobbie - avatar
+ 1
Thank you visph I will try that. The advice here is so much better than the varied answers I get from Google when I attempt to ask. The helpful members here make learning this lots of fun!!!
25th Oct 2017, 11:37 AM
bobbie
bobbie - avatar
+ 1
Shane over on Slack showed me I needed to close the shapes after animateMotion <\rect><\polygon> it's working like a charm.
25th Oct 2017, 3:31 PM
bobbie
bobbie - avatar
+ 1
Thanks visph I thought they we're closed enough already ...live and learn.
25th Oct 2017, 4:25 PM
bobbie
bobbie - avatar
- 1
Si, tu puedes hacerlo!
25th Oct 2017, 12:41 AM
Raynier FernĂĄndez
Raynier FernĂĄndez - avatar