# HG changeset patch # User Matti Hamalainen # Date 1338212814 -10800 # Node ID 35374be74fdc7ee973b220ba82575889dc7018e4 # Parent 5b25561855c3f0dcba4bdf5a88adab685adf38ec Add some bling to piece rotation. diff -r 5b25561855c3 -r 35374be74fdc game/Piece.java --- 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)