Simplify time delta helper

This commit is contained in:
Christian Rocha 2021-07-13 20:39:37 -04:00
parent d56f9e806c
commit c6198b0130
No known key found for this signature in database
GPG Key ID: D6CC7A16E5878018

View File

@ -55,16 +55,15 @@ import (
"time"
)
// FPS returns a time delta for a given number of frames per second. This value
// can be used as the time delta when initializing a Spring.
// FPS returns a time delta for a given number of frames per second. This
// value can be used as the time delta when initializing a Spring.
//
// Example:
//
// spring := NewSpring(FPS(60), 0.8, 0.98)
//
func FPS(n int) float64 {
d := time.Second / time.Duration(n)
return float64(int64(d)) / float64(int64(time.Second))
return (time.Second / time.Duration(n)).Seconds()
}
// In calculus ε is (in vague terms) an arbitrarily small positive number. In