Mercurial > hg > ristipolku
changeset 149:35374be74fdc
Add some bling to piece rotation.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 28 May 2012 16:46:54 +0300 |
parents | 5b25561855c3 |
children | b0c05b8b59ca |
files | game/Piece.java |
diffstat | 1 files changed, 11 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/game/Piece.java Mon May 28 16:46:41 2012 +0300 +++ b/game/Piece.java Mon May 28 16:46:54 2012 +0300 @@ -28,9 +28,10 @@ active; float currAngle, rotationTime, rotationSpeed, - typeTime, typeValue, throbTime; + typeTime, typeValue, throbTime, currScale; Interpolate lerpRotation, + lerpScale, lerpType; @@ -45,13 +46,15 @@ rotationActive = false; currRotation = 4 * 5000; currAngle = getAngle(currRotation); + currScale = 1; typeChanged = false; typeActive = false; throbTime = 0; - lerpType = new Interpolate(1.0f, 0.0f, maxTime); + lerpType = new Interpolate(1.0f, 0.0f, maxTime); + lerpScale = new Interpolate(0.0f, (float) Math.PI, maxTime); // Initialize connections between endpoints of the paths inside the piece for (int i = 0; i < numConnections; i++) @@ -229,7 +232,10 @@ float t = (time - rotationTime) * rotationSpeed; if (t < maxTime) + { currAngle = lerpRotation.getValue(t); + currScale = (float) (1.0 + Math.sin(lerpScale.getValue(t)) * 0.25); + } else { currAngle = lerpRotation.start; @@ -274,6 +280,9 @@ AffineTransform save = g.getTransform(); Composite csave = g.getComposite(); + // Scale dimensions + dim = dim * currScale; + // Change compositing alpha for the whole piece drawing // when the piece is being "introduced". if (typeActive)