Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to use classList.toggle for <image id="heartRateIcon"/>

ANSWERED

Hello.

 

I would like to have a heart beat animation on a clock face.

 

For example, the following code is working.

 

<text id="heartRateText">---</text>
:
:
const heartRateText = document.getElementById("heartRateText");
:
:
heartRateText.text = hrm.heartRate;

However, I can not add or remove class to the following heartRateIcon for heart beat animation.

const heartRateIcon = document.getElementById("heartRateIcon");

Could you teach me how to change the state of objects?

Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions
Best Answer
0 Votes
3 REPLIES 3

Assuming the icon is an image, change the image's href. You're right that fitbit doesn't let us change classes at run time.

Peter McLennan
Gondwana Software
Best Answer

Thank you for your reply.

My code was the following:

 

/* index.gui */
<image id="activityIcon"/>
:
:
/* styles.css */
#heartRateIcon {
  x: 21;
  y: 75%;
  width: 48;
  height: 48;
  href: "stat_hr_solid_48px.png";
  fill: red;
}
Best Answer
0 Votes
Best Answer
0 Votes