# Change of opacity based on minutes

I would like to change the opacity of an object - it should be 100% between 5 and 25 minutes and between 35 and 55 minutes - otherwise it should be 60%. Or simpler said - the opacity of the object should be 60% between minutes 25 & 35 and 55 & 5 - otherwise it should be 100%.

How would I write the expressions for the opacity box for that:

I have:

((([MIN]>=5)&&([MIN]<=25))?100:(([MIN]>=35)&&([MIN]<=55))?100:60)

but this does not work.

Any help greatly appreciated…

1 Like

Hello,
try it like this. In preview it works, but I have no wearOS watch to test it on device.

but to cut the interval more precisely maybe you would want it more like
`-40*(([MIN]>=55)+([MIN]<5)+([MIN]>=25)*([MIN]<35))`

3 Likes

Hello @Peter - thanks so much for your quick reply - very much appreciated. This worked like a charm!

2 Likes

Great to see some advanced Conditional Work. May I join in and say thanks Peter. Tutorial Bookmarked.

Thanks for praise Russel, but it is all based on the public guide

2 Likes

Thanks for the Link . I have that Bookmarked but I have not seen the Voodoo that You Do .Just need good examples to learn the difference between + and + . It is different from other code I have read but I am beginning to understand it a bit now . As there are not a lot of Inspectable Code here , one has to grab what is offered with Both Hands . You know that your Contribution to Community is much appreciated .

While we are talking code/formulas may I share this . Just substitute what is in between [ ] to make your own Digital Roman Watch . Not you have to use " " to embrace text . not needed for numbers . I was surprise it could work .

`([SEC]==0?"LX":"")([SEC]==1?"I":"")([SEC]==2?"II":"")([SEC]==3?"III":"")([SEC]==4?"IV":"")([SEC]==5?"V":"")([SEC]==6?"VI":"")([SEC]==7?"VII":"")([SEC]==8?"VIII":"")([SEC]==9?"IX":"")([SEC]==10?"X":"")([SEC]==11?"XI":"")([SEC]==12?"XII":"")([SEC]==13?"XIII":"")([SEC]==14?"XIV":"")([SEC]==15?"XV":"")([SEC]==16?"XVI":"")([SEC]==17?"XVII":"")([SEC]==18?"XVIII":"")([SEC]==19?"XIX":"")([SEC]==20?"XX":"")([SEC]==21?"XXI":"")([SEC]==22?"XXII":"")([SEC]==23?"XXIII":"")([SEC]==24?"XXIV":"")([SEC]==25?"XXV":"")([SEC]==26?"XXVI":"")([SEC]==27?"XXVII":"")([SEC]==28?"XXVIII":"")([SEC]==29?"XXIX":"")([SEC]==30?"XXX":"")([SEC]==31?"XXXI":"")([SEC]==32?"XXXII":"")([SEC]==33?"XXXIII":"")([SEC]==34?"XXXIV":"")([SEC]==35?"XXXV":"")([SEC]==36?"XXXVI":"")([SEC]==37?"XXXVII":"")([SEC]==38?"XXXVIII":"")([SEC]==39?"XXXIX":"")([SEC]==40?"XL":"")([SEC]==41?"XLI":"")([SEC]==42?"XLII":"")([SEC]==43?"XLIII":"")([SEC]==44?"XLIV":"")([SEC]==45?"XLV":"")([SEC]==46?"XLVI":"")([SEC]==47?"XLVII":"")([SEC]==48?"XLVIII":"")([SEC]==49?"XLIX":"")([SEC]==50?"L":"")([SEC]==51?"LI":"")([SEC]==52?"LII":"")([SEC]==53?"LIII":"")([SEC]==54?"LIV":"")([SEC]==55?"LV":"")([SEC]==56?"LVI":"")([SEC]==57?"LVII":"")([SEC]==58?"LVIII":"")([SEC]==59?"LIX":"")`

1 Like

I just would not have the patience to write such long expression

2 Likes

A lot of Copy and paste on Notepad . There is a Find facility but not Find and Replace . I am frightened to use anything else because of the formatting . It suits me :::)))

I use excel for automating substitution (ctrl+h)
and even for synthesizing long expressions

2 Likes

Yeah Thanks . I must upgrade what I do a bit .

Hi Peter - one variation of this: would it be possible to fade in a layer when the watch wakes up and have it stay for 2 seconds and then fade back out and stay hidden? Meaning this layer would only activate when the watch wakes up from the AOD state?

1 Like

Sorry Andi I see no other way than “masking it” under an animation sequence, since WFS has no tag for “elapsed time since wake up”. I have no experience with this, but I think the number of slides would depend on how fast you would want it to play, since the frame rate is fixed to 15fps. There would be starting batch changing from black (or fully opaque to transparent, then batch of 30 identical transparent images and another transition images into fully opaque again.

1 Like

Hi Peter - thanks for your always to the point tips and helpful suggestions - very much appreciated.

1 Like

Hi @andi-sf where did you put this expression? when I select the opacity in WFS there is no “tag” selection. thanks, Daryl

The opacity field has default value 100. If you hover the mouse over that number, in the right part of the field there appears a button to open pop-up window for inserting the expressions with tags.

1 Like