comparison game/Interpolate.java @ 7:70714c229e23

More work.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 28 Jan 2011 20:23:21 +0200
parents 44f1e7b47fcf
children 59ff451750fb
comparison
equal deleted inserted replaced
6:be0bf7544069 7:70714c229e23
6 6
7 import java.util.*; 7 import java.util.*;
8 8
9 public class Interpolate 9 public class Interpolate
10 { 10 {
11 double start, end, steps; 11 float start, end, steps;
12 12
13 public Interpolate(double start, double end, double 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 double getValue(double step) 20 public float getValue(float step)
21 { 21 {
22 double n = step / steps; 22 float n = step / steps;
23 double 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 }