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

I think this might work:

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

I hope it helps.

2 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!!!

3 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$

1 Like

Nice additions and great advice, thanks!

2 Likes

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

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))

3 Likes

looking good, keep it up