Re: [elm-discuss] How to render at a lower fps in 0.17?

2016-05-17 Thread Peter Damoc
Oh well, you can always use an accumulator like `timeSinceLastFrame` and
check it against some timePerFrame that you want.
If the time is greater than timePerFrame, reset to
(timeSinceLastFrame-timePerFrame) and update the module state. If not, just
add the delta to timeSinceLastFrame.

You won't get the precision of a specific FPS but you should get a
consistent behavior.




On Tue, May 17, 2016 at 3:37 PM, Wil C  wrote:

> Good questions. Maybe I should state the problem first.
>
> I'm writing a simple game, which makes me think that using
> AnimationFrame.diff is the right way to go, since it lines up with the
> browser's rendering. I want to spend less time rendering, and use that time
> for other things, like calculating next enemy movements. Since I think my
> game would still be fun at 30fps, I'd want to run it at half speed.
>
> Wil
>
>
> On Monday, May 16, 2016 at 11:01:46 PM UTC-7, Max Goldstein wrote:
>>
>> You can use Time.every to get deltas if you store the old one in the
>> model. The best use, other than the actual time, is things you want to
>> happen periodically but the exact millisecond doesn't matter. If you're
>> doing animation, I'll echo Peter: what's wrong with animating on the
>> browser's exact frames?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Elm Discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to elm-discuss+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
There is NO FATE, we are the creators.
blog: http://damoc.ro/

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [elm-discuss] How to render at a lower fps in 0.17?

2016-05-17 Thread Max Goldstein
You can use Time.every to get deltas if you store the old one in the model. The 
best use, other than the actual time, is things you want to happen periodically 
but the exact millisecond doesn't matter. If you're doing animation, I'll echo 
Peter: what's wrong with animating on the browser's exact frames?

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[elm-discuss] How to render at a lower fps in 0.17?

2016-05-16 Thread Wil C
I've made the switch to 0.17, and I've also followed along with the mario 
example . 
I can see how to get the delta, but it's locked in at around 60 fps with a 
subscription like "AnimationFrame.diffs Tick". How do I subscribe to 
AnimationFrame.diff with a lower framerate? It doesn't looks like I can use 
Time.every.

Wil 

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.