Image Flash rate synced with bpm/#ZHR#

Hello !

I would like to flash/pulsate an image according to the heart rate. But I dont know how to use the sine function properly for this. The outcome should be to show and hide an image 80 times a minute if the heart rate is 80 and so on. Any help is highly appreciated !
Cheers, H.

Edit:
I tried (clamp(((cos(#ZHR#)*50)+50),0,100)) where ZHR is my rate, 50 the heigt and 50 the offset. limited with values 0 and 100. I am just not sure how to bring the rate under control so its corresponding to actual bpm

1 Like

I think this might work:

transparency: (50+50sin(2pi*#Dsm#*#ZHR#/60))

I hope it helps.

3 Likes

Tested and working fine! Thanks Mike, just replaced 2pi for 6.28
(50+50
sin(6.28*#Dsm#*#ZHR#/60))

Note: in watches without sensor the tag returns zero and break the formula, so is better to use a conditional like
$#ZHR#>0?(50+50sin(6.28#Dsm# * #ZHR#/60)):(100-200*((#Dsm#/2)%0.5))$
where if the tag is zero remains a steady half of a second pulse.
Take out the spaces between the tags!!!

5 Likes

Worked like a charm for me, thank you !!

I also used a variation for a motorcycle image to let it wheel under certain conditions:)
Rotation: $#WM#==C&&#WFAH#>20?(-30+30sin(2pi*#Dsm#*0.5)):0$
Transparency: $#WM#==C&&#WFAH#>15&&#WFACI#<04?80:0$

2 Likes

Nice additions and great advice, thanks!

3 Likes

I’m glad it worked - it looks like you get the hang of it :slight_smile:

1 Like

Just worked out an expression for a progress bar filling up using the heartrate tag. I don’t really know how I figured it out, but this topic helped me a lot. thank you

I am really new to this, so I just added it to the fill ratio
(clamp((sin((6.28*#Dsm#*#ZHR#)/60)),0,1))

5 Likes

looking good, keep it up

1 Like

I know this post has been up for a while but I’ve tried these formulas and couldn’t get any to work. The image transparency stays at 0%.

If you put #ZHR# in a text layer do you get a sensible number?

This might be a problem that others are having on the GW4 ( refer: Galaxy Watch 4 Heart Rate Errors ). If so then raising a support request would be a good idea. Even if it has been reported already, I think that the support team still wants to know how widespread an issue is and which watches/phone makes/models are impacted.

1 Like

I have no problem with the bpm text. It reads fine. Also, the formula results in 0 in the creator and doesn’t change when the watch is animated.

Ok good to know. Would you please paste the exact text of the expression you are using or post a link to a face with the issue with inspection mode on and I’ll take a look to see if I can see a problem.

1 Like

Ok, I’m new to this so I’ll see if I can figure that out. As for the expressions I just copied and pasted each one that was posted above with the exception of the one that said remove the spaces which I did. None of them seemed to work for me.

If you run the face in Creator ( by pressing the play button at the bottom of the page ) does the expression stay at zero?

Ok, I retried all the different formulas on this post again before replying. All but one return with nothing and this one “(clamp((sin((6.28*#Dsm#*#ZHR#)/60)),0,1))” is just a zero and none of them change when the creator is animated (pressing play).

I tried the one you just mentioned and it works for me in Creator. Are you sure that when you paste it into the text field that there are no spaces before or after the expression?

If you publish a test face with the set of expressions in text fields and inspection mode on I’ll take a look - it is a bit hard otherwise for me to think what might be going wrong.

1 Like

I think I figured out another way using the formula i have to make the time colon blink with the seconds. It seems to work. $floor(#DNOW#/(1000/(#ZHR#/30)))%2=0?100:0$.

3 Likes

Cool effect, I would love to use it but doesn’t work for me also.

None of the formulas work in creator nor on watch (Samsung watch 4).

Don’t know why.

It should be added to Opacity, I suppose.

If you use a progress bar it goes in fill ratio shield, you can use also a shape unless a progress bar and use different formulas in width or hight shield

1 Like