Created
September 12, 2013 09:16
-
-
Save TakamiChie/6534859 to your computer and use it in GitHub Desktop.
TranslateAnimationの注意点 ref: http://qiita.com/TakamiChie/items/ec32131f89dd2623913c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected float resolveSize(int type, float value, int size, int parentSize) { | |
switch (type) { | |
case ABSOLUTE: | |
return value; | |
case RELATIVE_TO_SELF: | |
return size * value; | |
case RELATIVE_TO_PARENT: | |
return parentSize * value; | |
default: | |
return value; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TranslateAnimation anim = new TranslateAnimation( | |
TranslateAnimation.RELATIVE_TO_SELF, 0, | |
TranslateAnimation.RELATIVE_TO_SELF, 0, | |
TranslateAnimation.ABSOLUTE, /* 今のビュー座標 */, | |
TranslateAnimation.ABSOLUTE, /* 移動したいビュー座標 */); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TranslateAnimation anim = new TranslateAnimation( | |
TranslateAnimation.RELATIVE_TO_SELF, 0, | |
TranslateAnimation.RELATIVE_TO_SELF, 0, | |
TranslateAnimation.RELATIVE_TO_SELF, 0, | |
TranslateAnimation.ABSOLUTE, /* 移動したいビュー座標 - 今のビュー座標 */); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public TranslateAnimation(float fromXDelta, float toXDelta, float fromYDelta, float toYDelta) { | |
mFromXValue = fromXDelta; | |
mToXValue = toXDelta; | |
mFromYValue = fromYDelta; | |
mToYValue = toYDelta; | |
mFromXType = ABSOLUTE; | |
mToXType = ABSOLUTE; | |
mFromYType = ABSOLUTE; | |
mToYType = ABSOLUTE; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment