Mercurial > hg > ristipolku
comparison game/AnimatedPointElement.java @ 134:4c0dec72e2f0
Whitespace cosmetic cleanup.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 24 Nov 2011 21:51:54 +0200 |
parents | a0376e40102e |
children | 5eea4719b429 |
comparison
equal
deleted
inserted
replaced
133:881deac2daf8 | 134:4c0dec72e2f0 |
---|---|
15 private float stime, value, steps; | 15 private float stime, value, steps; |
16 private IDMPoint pos; | 16 private IDMPoint pos; |
17 private Interpolate lerpV, lerpX, lerpY; | 17 private Interpolate lerpV, lerpX, lerpY; |
18 boolean active, first; | 18 boolean active, first; |
19 String text; | 19 String text; |
20 | 20 |
21 public AnimatedPointElement(IDMPoint start, String text) | 21 public AnimatedPointElement(IDMPoint start, String text) |
22 { | 22 { |
23 Random rnd = new Random(); | 23 Random rnd = new Random(); |
24 steps = 100; | 24 steps = 100; |
25 | 25 |
30 pos = new IDMPoint(start); | 30 pos = new IDMPoint(start); |
31 active = false; | 31 active = false; |
32 first = true; | 32 first = true; |
33 this.text = text; | 33 this.text = text; |
34 } | 34 } |
35 | 35 |
36 public void animate(float time) | 36 public void animate(float time) |
37 { | 37 { |
38 if (first) | 38 if (first) |
39 { | 39 { |
40 first = false; | 40 first = false; |
41 active = true; | 41 active = true; |
42 stime = time; | 42 stime = time; |
43 } | 43 } |
44 | 44 |
45 if (active) | 45 if (active) |
46 { | 46 { |
47 float t = (time - stime); | 47 float t = (time - stime); |
48 if (t >= steps) | 48 if (t >= steps) |
49 { | 49 { |
54 value = lerpV.getValue(t); | 54 value = lerpV.getValue(t); |
55 pos.x = lerpX.getValue(t); | 55 pos.x = lerpX.getValue(t); |
56 pos.y = lerpY.getValue(t); | 56 pos.y = lerpY.getValue(t); |
57 } | 57 } |
58 } | 58 } |
59 | 59 |
60 public void paint(Graphics2D g) | 60 public void paint(Graphics2D g) |
61 { | 61 { |
62 if (!active) | 62 if (!active) |
63 return; | 63 return; |
64 | 64 |
65 Paint psave = g.getPaint(); | 65 Paint psave = g.getPaint(); |
66 AffineTransform tsave = g.getTransform(); | 66 AffineTransform tsave = g.getTransform(); |
67 Composite csave = g.getComposite(); | 67 Composite csave = g.getComposite(); |
68 | 68 |
69 // g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, typeValue)); | 69 // g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, typeValue)); |