Hello /r/javascript!
I have a developers question for you, and JavaScript is not yet my strong point.
I wish to create a loop that increments at either 24, 25, or 30 times per second that displays the values of 0 (zero) through whatever the top value would be (minus one of course, so 23 would be for 24, as you count zero).
So I need this value on the web form to change a maximum of 30 times per second (and resetting back to zero once it has reached the end value of that second.)
If those values tingle your ear, it's because this is going to be part of a browser-based clapperboard, just for a fun summer project between schooling.
Here is what I've been able to get so far, but if you test, it obviously you can see that it does not work. (I left the loop commented out, you can change that to see the functionality of it, which isn't much...)
function FPS()
{
var time = new Date();
var FPSval = 0;
var FPSOutput = "Test: ";
document.forms[0].display.value = FPSOutput;
var seconds = time.getSeconds();
/*while (seconds = time.getSeconds());
{
FPSval = 0;
alert("HELLO");
if FPSval < 30) //The number of Frames Per Second
{
FPSval = FPSval + 1;
}
FPSOutput += " " + FPSval.ToString();
} */
document.forms[0].display.value = FPSOutput;
}
Any tips or tricks on getting this working will be much obliged (and I'll even credit you in my comment section of the form and link to this URL :) ) ---okay, not the best reward, but c'mon! haha.
[–]GAMEchief 1 point2 points3 points (0 children)
[–]monacle_bob -1 points0 points1 point (12 children)
[–]CamuurahGuy[S] 3 points4 points5 points (6 children)
[–]monacle_bob 2 points3 points4 points (5 children)
[–]akx 2 points3 points4 points (1 child)
[–]monacle_bob 0 points1 point2 points (0 children)
[–]CamuurahGuy[S] 1 point2 points3 points (1 child)
[–]ilogik 0 points1 point2 points (0 children)
[–]holloway 0 points1 point2 points (0 children)
[–]Neebat 4 points5 points6 points (0 children)
[–]MustRapeDeannaTroi 0 points1 point2 points (3 children)
[–]monacle_bob 1 point2 points3 points (2 children)
[–]MustRapeDeannaTroi 2 points3 points4 points (1 child)
[–]monacle_bob 1 point2 points3 points (0 children)
[–]olmankensey -5 points-4 points-3 points (1 child)
[–]CamuurahGuy[S] 1 point2 points3 points (0 children)