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

Variable value passage from .js to .gu

ANSWERED

Hello, I recently start to making watch faces with fitbitStudio and some important programming rules I don't know yet, so I decided to ask the community. 

 

index.js code: 

 

let floorsValue = (userActivity.today.adjusted["elevationGain"] || 0);
txtFloors.text = floorsValue;
Elevation = ((floorsValue * 167)/8000);

 

index.gui code:

<circle cx="30" cy="202-Elevation" r="7" fill="#444444"/>

 

I would like move this circumference only on the y axis as a function of the Elevation value. How can I do it?

 

Thanks for your attention

Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions
Best Answer
0 Votes
6 REPLIES 6

Get a reference to the element object in .js, typically using getElementById. Then manipulate the equivalent property in js; something like myCircle.cy=202-Elevation

Peter McLennan
Gondwana Software
Best Answer
0 Votes

let Elevation= document.getElementById("Elevation");

 

let floorsValue = (userActivity.today.adjusted["elevationGain"] || 0);
txtFloors.text = floorsValue;
Elevation = ((floorsValue * 167)/8000);

 

 

<circle cx="30" myCircle.cy = "202-Elevation" r="7" fill="#444444"/>

 

In this way?

Best Answer
0 Votes
Best Answer
0 Votes

I managed to do the variable pass, but send me this error: Error 22 Invalid length value 'myCircle'. It is possible becouse is a number with a comma ?

Best Answer
0 Votes

I have done it!! thank you

Best Answer

Well done! 🙂

Peter McLennan
Gondwana Software
Best Answer
0 Votes