Choosing image display shown based upon conditions

I am working on a battery indicator based upon a motorcycle fuel guage…
I have several colors of the indicator light all as separate images, sized the same, and all at the same location. I am attempting to make which is visible by tags on color opacity…
For example, the green one should be visible if the battery is charging, so I have tried these tag expressions:
[BATT_IS_CHARGE]? 100, 0
( [BATT_IS_CHARGE] == 0 )? 0, 100
But when I change the charging status in the DEVICE section, I don’t ever see the effect of the tag expressions. Instead I only ever see the effect by manually changing the number
It never seems to honor the calculated tag value
Am I going about my image selection in what should be a valid way?

Wrong code.

This is the correct code.

([BATT_IS_CHARGE]? 100:0)

: not ,

You can check this Code Lab

for more Challenging masking image tips using tag expression.

Hi, that doesnt answer main question, his talking about the tag expression of battery and condition expression to control opacity.

For his case masking i think is overkill.

This would be better link.

Tag expressions | Samsung Developers.

Refer to ternary operator

Thanks for the feedback. I didn’t mean to use masks on this project. This may help him to think another way.
The code lab contains many tag expressions not only mask.
Your Tag expression code lab also is helpful for him.
Happy designing.

1 Like