# Perspective large and complex SVG animation tips please

**URL:** <https://forum.inductiveautomation.com/t/perspective-large-and-complex-svg-animation-tips-please/63526>\
**Category:** Ignition\
**Tags:** perspective, ignition81\
**Created:** [August 27, 2022, 8:21am UTC](https://forum.inductiveautomation.com/t/perspective-large-and-complex-svg-animation-tips-please/63526 "2022-08-27T08:21:06Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [August 30, 2022, 4:39am UTC](https://forum.inductiveautomation.com/t/perspective-large-and-complex-svg-animation-tips-please/63526/21 "2022-08-30T04:39:27Z")

</div>

> [@jlandwerlen](#):
>
> If you use bindings and update the SVG, then you will most likely wipe out and break the bindings

If you were careful with how you added new elements into the SVG, you could avoid breaking the original bindings. You just need to embed the updated SVG, copy the `props.elements` and then paste over the top of the existing embedded SVG. However, if you stuff up and change the order of your elements, the bindings could become mismatched to their elements and now apply to the wrong SVG elements... not ideal

---

<div class="post-metadata">

**Author:** ![Alistair](https://avatars.discourse-cdn.com/v4/letter/a/f6c823/32.png) [@Alistair](https://forum.inductiveautomation.com/u/Alistair)\
**Post date:** [August 30, 2022, 5:25am UTC](https://forum.inductiveautomation.com/t/perspective-large-and-complex-svg-animation-tips-please/63526/22 "2022-08-30T05:25:41Z")

</div>

Yeah, I agree. Hence my theory on breaking down the layout to small, manageable chunks, where say each machine was an individual drawing, and then just overlay them. If you break something, it’s only a small bit.  
I thought I had a good plan, but now I realize I know less than I thought.

Nadar’s scripting method seems interesting to explore. I can see the benefit of being resilient to layout changes.

I was hoping to expose some proven method or some common traps. I can see that I need to learn more about Inkscape and how to optimize SVGs for Perspective. Any good resources out there?

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [August 31, 2022, 3:13pm UTC](https://forum.inductiveautomation.com/t/perspective-large-and-complex-svg-animation-tips-please/63526/23 "2022-08-31T15:13:28Z")

</div>

Here are a couple of posts with good information pertaining to Inkscape.

> [@\[BUG-11342\] Perspective - Can't draw any shapes](https://forum.inductiveautomation.com/t/bug-11342-perspective-cant-draw-any-shapes/20690/22):
>
> Not sure if worth mentioning, that if you do use Inkscape, you should save your SVGs as an Optimised SVG and not as an Inkscape SVG. It pulls all the crap out of the file. I use these settings fwiw: Edit: uncheck the top option, don't remove unused ids [image] [image] [image] Edit: maybe should uncheck the convert css to XML option

> [@Creating optimised SVG in Inkscape results in elements grouped oddly](https://forum.inductiveautomation.com/t/creating-optimised-svg-in-inkscape-results-in-elements-grouped-oddly/40715):
>
> This is more an informative post about creating SVGs in Inkscape… It started off as a question but then turned into an answer as I worked through it. I have quite a complex SVG for swing bend pipes that connect ports of a key plate together to complete various pipework circuits. As such, i’ve grouped common swing bends together and tried to style them so that they all have the same stroke widths and linecaps. However it seems that in applying some of these settings to groups of objects, it’s i…

For relatively simple SVG's here is the way that I do it.

> [@Drawing Tools in perspective](https://forum.inductiveautomation.com/t/drawing-tools-in-perspective/51407/3):
>
> SVG’s are the way to do it (they aren’t the only way to do it, but they are probably the best way). You can copy this into a text file, save it as a .svg file and then drag it onto your view, this will give you a blank SVG. \<?xml version="1.0" encoding="UTF-8" standalone="no"?\> \<svg xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" width="50mm" height="50mm" viewBox="0 0 50 50" version="1.1"\> \</svg\> From there it is just a matter of understanding how to wor…

---

<div class="post-metadata">

**Author:** ![Steve\_Laubach](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/steve_laubach/32/60900_2.png) [@Steve\_Laubach](https://forum.inductiveautomation.com/u/Steve_Laubach)\
**Post date:** [September 12, 2022, 5:46pm UTC](https://forum.inductiveautomation.com/t/perspective-large-and-complex-svg-animation-tips-please/63526/24 "2022-09-12T17:46:51Z")

</div>

I hadn’t noticed the embed feature on the image library but I compared one of my SVGs in Embedded mode (right) vs Image Library mode (left).

The embedded one is missing a lot of detail and skews the color overlay when I resize it.  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/c/1cb01e514c9764f792f77c474c8a34b120eb5597.png)

My conclusion is that the embedded version is good for lower detail SVGs and image library is good if you want to have higher detail. It’s possible I’m doing something wrong with my embedded one. I just drug the svg onto the form and selected the “embed” option. On the other hand, I like the idea of embedded SVGs for animation capabilities and lack of reliance on the image library.

We animate changeable valve paths for process valves on some projects so I need the overlays to scale properly for it to look good.

Am I doing something wrong?

PS  
I’ve also noticed that some of the more fancy gradients you can do in inkscape will not show up in Ignition when you embed the SVG in the image library.

---

<div class="post-metadata">

**Author:** ![Alistair](https://avatars.discourse-cdn.com/v4/letter/a/f6c823/32.png) [@Alistair](https://forum.inductiveautomation.com/u/Alistair)\
**Post date:** [September 12, 2022, 7:26pm UTC](https://forum.inductiveautomation.com/t/perspective-large-and-complex-svg-animation-tips-please/63526/25 "2022-09-12T19:26:36Z")

</div>

I wonder if the difference with the embedded version is the stroke width (and maybe other parameters) either missing or the value (for example .5) is a string and you need to edit it to 0.5?  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/e/1e3f26445e6e3483d931b16f6a6eab3b95e65672.png)

---

<div class="post-metadata">

**Author:** ![Steve\_Laubach](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/steve_laubach/32/60900_2.png) [@Steve\_Laubach](https://forum.inductiveautomation.com/u/Steve_Laubach)\
**Post date:** [September 12, 2022, 7:44pm UTC](https://forum.inductiveautomation.com/t/perspective-large-and-complex-svg-animation-tips-please/63526/26 "2022-09-12T19:44:56Z")

</div>

The stroke is definitely different because the embedded one shows a fine stroke width and the unembedded one shows a thick one. I could go into it and modify the stroke but several of the gradients don’t render at all.

---

<div class="post-metadata">

**Author:** ![Alistair](https://avatars.discourse-cdn.com/v4/letter/a/f6c823/32.png) [@Alistair](https://forum.inductiveautomation.com/u/Alistair)\
**Post date:** [September 12, 2022, 8:04pm UTC](https://forum.inductiveautomation.com/t/perspective-large-and-complex-svg-animation-tips-please/63526/27 "2022-09-12T20:04:00Z")

</div>

I don’t know anything about how to fix the gradients, sorry. But there are some much cleverer people on here than me, that likely will…

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [September 12, 2022, 8:36pm UTC](https://forum.inductiveautomation.com/t/perspective-large-and-complex-svg-animation-tips-please/63526/28 "2022-09-12T20:36:42Z")

</div>

We’re actively working on improving our parsing of SVGs with more complicated features. Nothing to share yet, but it looks promising.

---

<div class="post-metadata">

**Author:** ![Alistair](https://avatars.discourse-cdn.com/v4/letter/a/f6c823/32.png) [@Alistair](https://forum.inductiveautomation.com/u/Alistair)\
**Post date:** [September 12, 2022, 9:03pm UTC](https://forum.inductiveautomation.com/t/perspective-large-and-complex-svg-animation-tips-please/63526/29 "2022-09-12T21:03:33Z")

</div>

Like +1!  
I guess you can’t say how far away this is, this year or next?

---

<div class="post-metadata">

**Author:** ![nader.chinichian](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nader.chinichian/32/9261_2.png) [@nader.chinichian](https://forum.inductiveautomation.com/u/nader.chinichian)\
**Post date:** [September 14, 2022, 5:03am UTC](https://forum.inductiveautomation.com/t/perspective-large-and-complex-svg-animation-tips-please/63526/30 "2022-09-14T05:03:21Z")

</div>

I wish it includes SVG filtering effect too

---

<div class="post-metadata">

**Author:** ![tcrucet](https://avatars.discourse-cdn.com/v4/letter/t/76d3ee/32.png) [@tcrucet](https://forum.inductiveautomation.com/u/tcrucet)\
**Post date:** [December 14, 2022, 5:45pm UTC](https://forum.inductiveautomation.com/t/perspective-large-and-complex-svg-animation-tips-please/63526/31 "2022-12-14T17:45:23Z")

</div>

Are you talking about a global always-running script that controls the svg elements on a view? That watches tags and then searches for the appropriate element on that view to change its property? Where would that sentinel script live in the project?

---

<div class="post-metadata">

**Author:** ![nader.chinichian](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nader.chinichian/32/9261_2.png) [@nader.chinichian](https://forum.inductiveautomation.com/u/nader.chinichian)\
**Post date:** [December 15, 2022, 5:02am UTC](https://forum.inductiveautomation.com/t/perspective-large-and-complex-svg-animation-tips-please/63526/32 "2022-12-15T05:02:58Z")

</div>

Yes exactly. I do this instead of binding 500 item manually.  
Create a property in view and add now(2000) and add script transform after it and out your code

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [December 15, 2022, 8:17am UTC](https://forum.inductiveautomation.com/t/perspective-large-and-complex-svg-animation-tips-please/63526/33 "2022-12-15T08:17:11Z")

</div>

> [@nader.chinichian](#):
>
> now(2000) and add script transform after it and out your code

I wonder how efficient this is for say, 150 clients?

---

<div class="post-metadata">

**Author:** ![tcrucet](https://avatars.discourse-cdn.com/v4/letter/t/76d3ee/32.png) [@tcrucet](https://forum.inductiveautomation.com/u/tcrucet)\
**Post date:** [December 15, 2022, 1:46pm UTC](https://forum.inductiveautomation.com/t/perspective-large-and-complex-svg-animation-tips-please/63526/34 "2022-12-15T13:46:30Z")

</div>

I was thinking about using an expression structure to look at multiple tags all at once and react to them in a script transform. Is this the approach you use? I've heard of people using byte arrays.

---

<div class="post-metadata">

**Author:** ![tcrucet](https://avatars.discourse-cdn.com/v4/letter/t/76d3ee/32.png) [@tcrucet](https://forum.inductiveautomation.com/u/tcrucet)\
**Post date:** [December 15, 2022, 11:25pm UTC](https://forum.inductiveautomation.com/t/perspective-large-and-complex-svg-animation-tips-please/63526/35 "2022-12-15T23:25:32Z")

</div>

In your python script do you programatically traverse the JSON to look for uniquely named layers and object ids? Or do you hard-code the paths (e.g. "if (some condition): **self.props.elements[0].elements[2].fill=blue**")? If the latter case it seems it would eventually break the script with successive altered SVG imports.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [December 15, 2022, 11:56pm UTC](https://forum.inductiveautomation.com/t/perspective-large-and-complex-svg-animation-tips-please/63526/36 "2022-12-15T23:56:16Z")

</div>

I'm fairly sure Nader finds the ids he assigns them and doesn't hard-code their "bindings". Hard-coding would half defeat the purpose of using the script afterall

---

<div class="post-metadata">

**Author:** ![Alistair](https://avatars.discourse-cdn.com/v4/letter/a/f6c823/32.png) [@Alistair](https://forum.inductiveautomation.com/u/Alistair)\
**Post date:** [December 16, 2022, 2:49am UTC](https://forum.inductiveautomation.com/t/perspective-large-and-complex-svg-animation-tips-please/63526/37 "2022-12-16T02:49:54Z")

</div>

Just after I finish struggling with svgs in the large project I'm working on, I'll bet IA are going to release drawing tools in Perspective, and it's going to be the best thing ever.

After I've shed a tear or two, I'll re-do all of the graphics and it will be a beautiful thing... 🤣

---

<div class="post-metadata">

**Author:** ![chaoliang](https://avatars.discourse-cdn.com/v4/letter/c/ba8739/32.png) [@chaoliang](https://forum.inductiveautomation.com/u/chaoliang)\
**Post date:** [December 16, 2022, 5:37am UTC](https://forum.inductiveautomation.com/t/perspective-large-and-complex-svg-animation-tips-please/63526/38 "2022-12-16T05:37:39Z")

</div>

how's the gateway handing all of these svgs on multiple clients opening at the same time?

---

<div class="post-metadata">

**Author:** ![tcrucet](https://avatars.discourse-cdn.com/v4/letter/t/76d3ee/32.png) [@tcrucet](https://forum.inductiveautomation.com/u/tcrucet)\
**Post date:** [December 16, 2022, 1:36pm UTC](https://forum.inductiveautomation.com/t/perspective-large-and-complex-svg-animation-tips-please/63526/39 "2022-12-16T13:36:41Z")

</div>

Yeah, probably. I'd imagine it'd be easier if your're a Python veteran. It seems like there should be a clean way to traverse JSON within an unknown amount of nesting in search of a unique id, then build a path to a nearby fill or classes property to animate. So far all I've found are techniques involving generators. I've found out that just referencing a needed property in script actually creates it, and then there's the elements.pop() function to get rid of conflicting properties...

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [December 16, 2022, 2:48pm UTC](https://forum.inductiveautomation.com/t/perspective-large-and-complex-svg-animation-tips-please/63526/40 "2022-12-16T14:48:09Z")

</div>

> [@tcrucet](#):
>
> if your're a Python veteran

Use Ignition very long, and you'll become one. (:

[Previous page](https://forum.inductiveautomation.com/t/perspective-large-and-complex-svg-animation-tips-please/63526.md?page=1)

[Next page](https://forum.inductiveautomation.com/t/perspective-large-and-complex-svg-animation-tips-please/63526.md?page=3)
