Photics' Free Template Problem - July 2016

Continuing the discussion from Free Hype Templates:

@Photics and everyone else who is viewing. I’m continuing the discussion here so that it doesn’t get too bloated in the other post.

So, I believe the open problem was getting around the ability to store the timestamps in an array (I’ll leave out whether this is good or not) and how to “trim” it as Michael has suggested.

Rather than post a solution here I’ll give it some time for you guys to think of how it could be done. I’m sure there are many ways. So, thinking caps on and reply with any suggestions or solutions you can think of

As an example, my first approach will be using the shift() and pop() methods :wink:

Just to keep things organised we should use the following convention

var timelist = [];

Good Luck!


@Photics, By the way, why did you add the setInterval when you are already using requestAnimationFrame? I mean, to me it seems redundant. You could just add the setter to the calculating() function.

That's what's nice about this problem. There doesn't have to be a single solution.

If I add the "set" to the requestAnimationFrame / calculating function, then it is run too frequently. This changes the way the animation works. I didn't like it. Also, I'm not sure what it does to performance. Running a "set" 60 times a second seems like a bad thing to do.