# Pipe multi color animation

**URL:** <https://forum.inductiveautomation.com/t/pipe-multi-color-animation/83316>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [December 19, 2023, 3:18pm UTC](https://forum.inductiveautomation.com/t/pipe-multi-color-animation/83316 "2023-12-19T15:18:02Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![valentin.guichard](https://avatars.discourse-cdn.com/v4/letter/v/2bfe46/32.png) [@valentin.guichard](https://forum.inductiveautomation.com/u/valentin.guichard)\
**Post date:** [December 19, 2023, 3:18pm UTC](https://forum.inductiveautomation.com/t/pipe-multi-color-animation/83316/1 "2023-12-19T15:18:02Z")

</div>

Hi,  
I have to do pipes animation for my customer, the problem is that the colour of the pipe have to change following the flow in the pipe. For example the pipe has to be blue when the valve XX is open and it has to be pink whe the valve YY is open.  
I don't know how to make it simple without getting an expression with a lot of or...  
Thanks,  
Valentin

---

<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 19, 2023, 3:19pm UTC](https://forum.inductiveautomation.com/t/pipe-multi-color-animation/83316/2 "2023-12-19T15:19:25Z")

</div>

If there are many colors, consider using the `lookup()` expression function. If a small number, the `case()` expression function is probably the easiest to use.

---

<div class="post-metadata">

**Author:** ![sammyjoe.gingras](https://avatars.discourse-cdn.com/v4/letter/s/54ee81/32.png) [@sammyjoe.gingras](https://forum.inductiveautomation.com/u/sammyjoe.gingras)\
**Post date:** [December 19, 2023, 3:36pm UTC](https://forum.inductiveautomation.com/t/pipe-multi-color-animation/83316/3 "2023-12-19T15:36:43Z")

</div>

I've already do this. I dont know if there is a better way to do it but here's what I do and it works:  
I've link a script to the STROKE PAINT property of the objet (piping, in your case):

```auto
//black color
if (({Tags/[put the link of your tag here]} && ! {[your tag here]}),
 color(0,0,0),
//other color (the color is the same of an other piping)
if ({Tags/_0909_PLC_111/TEST/_0909_FAS_tag_/Sts/InStatus/PosB},
 {[put your window name here].[put the name of the objet with the color you want].strokePaint}))

```

---

<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 19, 2023, 3:45pm UTC](https://forum.inductiveautomation.com/t/pipe-multi-color-animation/83316/4 "2023-12-19T15:45:52Z")

</div>

Uh, `if()` ≠ `case()`

Consider showing a complete real example (without placeholders).

---

<div class="post-metadata">

**Author:** ![sammyjoe.gingras](https://avatars.discourse-cdn.com/v4/letter/s/54ee81/32.png) [@sammyjoe.gingras](https://forum.inductiveautomation.com/u/sammyjoe.gingras)\
**Post date:** [December 19, 2023, 4:14pm UTC](https://forum.inductiveautomation.com/t/pipe-multi-color-animation/83316/5 "2023-12-19T16:14:37Z")

</div>

I did'nt see your comment before I write the message. I did a script with the fonction ''if'', as I write it below, and it work's. But as I said, it's probably not the greates way to do it. I will look for more information about the CASE command.

---

<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 19, 2023, 4:18pm UTC](https://forum.inductiveautomation.com/t/pipe-multi-color-animation/83316/6 "2023-12-19T16:18:23Z")

</div>

Be careful distinguishing between scripts (jython) and expressions (Ignition-specific). Very different behavior.

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [December 19, 2023, 6:44pm UTC](https://forum.inductiveautomation.com/t/pipe-multi-color-animation/83316/7 "2023-12-19T18:44:37Z")

</div>

If it helps you, think of expression functions as being like Excel formulas.  
You write an expression that returns one value as a function of none, one or more input values.  
You can't write a script or program in expression language.
