Mercurial > hg > ristipolku
comparison game/Interpolate.java @ 15:59ff451750fb
Cosmetics.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sun, 30 Jan 2011 06:13:45 +0200 |
parents | 70714c229e23 |
children | 41c6cca69d60 |
comparison
equal
deleted
inserted
replaced
14:ae717d7d05ae | 15:59ff451750fb |
---|---|
10 { | 10 { |
11 float start, end, steps; | 11 float start, end, steps; |
12 | 12 |
13 public Interpolate(float start, float end, float steps) | 13 public Interpolate(float start, float end, float steps) |
14 { | 14 { |
15 this.start = start; | 15 this.start = start; |
16 this.end = end; | 16 this.end = end; |
17 this.steps = steps; | 17 this.steps = steps; |
18 } | 18 } |
19 | 19 |
20 public float getValue(float step) | 20 public float getValue(float step) |
21 { | 21 { |
22 float n = step / steps; | 22 float n = step / steps; |
23 float v = n * n * (3.0f - 2.0f * n); | 23 float v = n * n * (3.0f - 2.0f * n); |
24 return (start * v) + (end * (1.0f - v)); | 24 return (start * v) + (end * (1.0f - v)); |
25 } | 25 } |
26 } | 26 } |