use of android.view.animation.TranslateAnimation in project Crouton by keyboardsurfer.
the class DefaultAnimationsBuilder method buildDefaultSlideInDownAnimation.
/**
* @param croutonView
* The croutonView which gets animated.
*
* @return The default Animation for a showing {@link Crouton}.
*/
static Animation buildDefaultSlideInDownAnimation(View croutonView) {
if (!areLastMeasuredInAnimationHeightAndCurrentEqual(croutonView) || (null == slideInDownAnimation)) {
slideInDownAnimation = new TranslateAnimation(// X: from, to
0, // X: from, to
0, // Y: from, to
-croutonView.getMeasuredHeight(), // Y: from, to
0);
slideInDownAnimation.setDuration(DURATION);
setLastInAnimationHeight(croutonView.getMeasuredHeight());
}
return slideInDownAnimation;
}
use of android.view.animation.TranslateAnimation in project Crouton by keyboardsurfer.
the class DefaultAnimationsBuilder method buildDefaultSlideOutUpAnimation.
/**
* @param croutonView
* The croutonView which gets animated.
*
* @return The default Animation for a hiding {@link Crouton}.
*/
static Animation buildDefaultSlideOutUpAnimation(View croutonView) {
if (!areLastMeasuredOutAnimationHeightAndCurrentEqual(croutonView) || (null == slideOutUpAnimation)) {
slideOutUpAnimation = new TranslateAnimation(// X: from, to
0, // X: from, to
0, // Y: from, to
0, // Y: from, to
-croutonView.getMeasuredHeight());
slideOutUpAnimation.setDuration(DURATION);
setLastOutAnimationHeight(croutonView.getMeasuredHeight());
}
return slideOutUpAnimation;
}
use of android.view.animation.TranslateAnimation in project SmartAndroidSource by jaychou2012.
the class PullScrollView method rollBackAnimation.
private void rollBackAnimation() {
TranslateAnimation tranAnim = new TranslateAnimation(0, 0, Math.abs(mInitTop - mCurrentTop), 0);
tranAnim.setDuration(200);
mHeader.startAnimation(tranAnim);
mHeader.layout(mHeader.getLeft(), mInitTop, mHeader.getRight(), mInitBottom);
// �����ƶ�����
TranslateAnimation innerAnim = new TranslateAnimation(0, 0, mContentView.getTop(), mContentRect.top);
innerAnim.setDuration(200);
mContentView.startAnimation(innerAnim);
mContentView.layout(mContentRect.left, mContentRect.top, mContentRect.right, mContentRect.bottom);
mContentRect.setEmpty();
// �ص�������
if (mCurrentTop > mInitTop + TURN_DISTANCE && mOnTurnListener != null) {
mOnTurnListener.onTurn();
}
}
use of android.view.animation.TranslateAnimation in project SmartAndroidSource by jaychou2012.
the class DragGridView method animateGap.
protected void animateGap(int target) {
for (int i = 0; i < getChildCount(); i++) {
View v = getChildAt(i);
if (i == dragged)
continue;
int newPos = i;
if (dragged < target && i >= dragged + 1 && i <= target)
newPos--;
else if (target < dragged && i >= target && i < dragged)
newPos++;
// animate
int oldPos = i;
if (newPositions.get(i) != -1)
oldPos = newPositions.get(i);
if (oldPos == newPos)
continue;
Point oldXY = getCoorFromIndex(oldPos);
Point newXY = getCoorFromIndex(newPos);
Point oldOffset = new Point(oldXY.x - v.getLeft(), oldXY.y - v.getTop());
Point newOffset = new Point(newXY.x - v.getLeft(), newXY.y - v.getTop());
TranslateAnimation translate = new TranslateAnimation(Animation.ABSOLUTE, oldOffset.x, Animation.ABSOLUTE, newOffset.x, Animation.ABSOLUTE, oldOffset.y, Animation.ABSOLUTE, newOffset.y);
translate.setDuration(animT);
translate.setFillEnabled(true);
translate.setFillAfter(true);
v.clearAnimation();
v.startAnimation(translate);
newPositions.set(i, newPos);
}
}
use of android.view.animation.TranslateAnimation in project Tapad by berict.
the class AnimateHelper method slideIn.
// Slide Animations
public void slideIn(final View view, final int delay, final long duration, String handlerName) {
final TranslateAnimation slideIn = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, -1, Animation.RELATIVE_TO_SELF, 0);
view.setVisibility(View.INVISIBLE);
slideIn.setInterpolator(new DecelerateInterpolator());
Map<String, Handler> handlerCreator = new HashMap<>();
handlerCreator.put(handlerName, new Handler());
handlerCreator.get(handlerName).postDelayed(new Runnable() {
@Override
public void run() {
view.setVisibility(View.VISIBLE);
slideIn.setDuration(duration);
view.startAnimation(slideIn);
Log.i(TAG, "slide IN effect for " + String.valueOf(duration) + "ms with " + String.valueOf(delay) + "ms delay");
}
}, delay);
}
Aggregations