Hello!
I'm working in a analog watch face, in which there is a filled circle at the end of the hour, minute and second hands. The code was working well, until I tried to condense it and write a function to set the hand coordinates (like the analog example, provided in the SDK). Then I will only get a "Error: Not Enough Arguments Error" console response.
This is the code, working as it should:
targetDc.fillCircle(
center[0] + (center[0] - 50) * Math.cos(hourHandAngle),
center[1] + (center[1] - 50) * Math.sin(hourHandAngle),
7
);
And there goes the function, arguments returned of it, and the console error log:
function handAttributes(center, distance, angle, radius) {
var attrib = new [3];
attrib = [
center[0] + (center[0] - distance) * Math.cos(angle),
center[1] + (center[1] - distance) * Math.sin(angle),
radius];
return attrib;
}
function onUpdate(dc) {
var width = targetDc.getWidth();
var height = targetDc.getHeight();
var clockTime = System.getClockTime();
var center = [width/2, height/2];
System.println(handAttributes(center, 50, hourHandAngle, 7));
targetDc.fillCircle(handAttributes(center, 50, hourHandAngle, 7)
);
}
[130.000000, 50.000000, 7] <--- It seems the function is working fine, returning an array with 3 values in it.
Error: Not Enough Arguments Error
Details: Failed invoking <symbol>
I am an absolute newbie in coding in general, and I'm probably missing something silly here, but can't figure it out! I'm using the latest SDK, and using mostly the Vivoactive 3 music as a simulator. Any suggestions?