use of android.view.animation.LinearInterpolator in project Depth-LIB-Android- by danielzeller.
the class PathBitmapMesh method startWaveAnim.
private void startWaveAnim(Bitmap bitmap, float waves, int animDuration) {
pathOffset = ValueAnimator.ofFloat(0, ((bitmap.getWidth() / waves) * 2f) / bitmap.getWidth()).setDuration(animDuration);
pathOffset.setRepeatCount(ValueAnimator.INFINITE);
pathOffset.setRepeatMode(ValueAnimator.RESTART);
pathOffset.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
pathOffsetPercent = (float) animation.getAnimatedValue();
}
});
pathOffset.setInterpolator(new LinearInterpolator());
pathOffset.start();
}
use of android.view.animation.LinearInterpolator in project XobotOS by xamarin.
the class StackView method handlePointerUp.
private void handlePointerUp(MotionEvent ev) {
int pointerIndex = ev.findPointerIndex(mActivePointerId);
float newY = ev.getY(pointerIndex);
int deltaY = (int) (newY - mInitialY);
mLastInteractionTime = System.currentTimeMillis();
if (mVelocityTracker != null) {
mVelocityTracker.computeCurrentVelocity(1000, mMaximumVelocity);
mYVelocity = (int) mVelocityTracker.getYVelocity(mActivePointerId);
}
if (mVelocityTracker != null) {
mVelocityTracker.recycle();
mVelocityTracker = null;
}
if (deltaY > mSwipeThreshold && mSwipeGestureType == GESTURE_SLIDE_DOWN && mStackSlider.mMode == StackSlider.NORMAL_MODE) {
// We reset the gesture variable, because otherwise we will ignore showPrevious() /
// showNext();
mSwipeGestureType = GESTURE_NONE;
// Swipe threshold exceeded, swipe down
if (mStackMode == ITEMS_SLIDE_UP) {
showPrevious();
} else {
showNext();
}
mHighlight.bringToFront();
} else if (deltaY < -mSwipeThreshold && mSwipeGestureType == GESTURE_SLIDE_UP && mStackSlider.mMode == StackSlider.NORMAL_MODE) {
// We reset the gesture variable, because otherwise we will ignore showPrevious() /
// showNext();
mSwipeGestureType = GESTURE_NONE;
// Swipe threshold exceeded, swipe up
if (mStackMode == ITEMS_SLIDE_UP) {
showNext();
} else {
showPrevious();
}
mHighlight.bringToFront();
} else if (mSwipeGestureType == GESTURE_SLIDE_UP) {
// Didn't swipe up far enough, snap back down
int duration;
float finalYProgress = (mStackMode == ITEMS_SLIDE_DOWN) ? 1 : 0;
if (mStackMode == ITEMS_SLIDE_UP || mStackSlider.mMode != StackSlider.NORMAL_MODE) {
duration = Math.round(mStackSlider.getDurationForNeutralPosition());
} else {
duration = Math.round(mStackSlider.getDurationForOffscreenPosition());
}
StackSlider animationSlider = new StackSlider(mStackSlider);
PropertyValuesHolder snapBackY = PropertyValuesHolder.ofFloat("YProgress", finalYProgress);
PropertyValuesHolder snapBackX = PropertyValuesHolder.ofFloat("XProgress", 0.0f);
ObjectAnimator pa = ObjectAnimator.ofPropertyValuesHolder(animationSlider, snapBackX, snapBackY);
pa.setDuration(duration);
pa.setInterpolator(new LinearInterpolator());
pa.start();
} else if (mSwipeGestureType == GESTURE_SLIDE_DOWN) {
// Didn't swipe down far enough, snap back up
float finalYProgress = (mStackMode == ITEMS_SLIDE_DOWN) ? 0 : 1;
int duration;
if (mStackMode == ITEMS_SLIDE_DOWN || mStackSlider.mMode != StackSlider.NORMAL_MODE) {
duration = Math.round(mStackSlider.getDurationForNeutralPosition());
} else {
duration = Math.round(mStackSlider.getDurationForOffscreenPosition());
}
StackSlider animationSlider = new StackSlider(mStackSlider);
PropertyValuesHolder snapBackY = PropertyValuesHolder.ofFloat("YProgress", finalYProgress);
PropertyValuesHolder snapBackX = PropertyValuesHolder.ofFloat("XProgress", 0.0f);
ObjectAnimator pa = ObjectAnimator.ofPropertyValuesHolder(animationSlider, snapBackX, snapBackY);
pa.setDuration(duration);
pa.start();
}
mActivePointerId = INVALID_POINTER;
mSwipeGestureType = GESTURE_NONE;
}
use of android.view.animation.LinearInterpolator in project TastyToast by yadav-rahul.
the class DefaultToastView method startViewAnim.
private ValueAnimator startViewAnim(float startF, final float endF, long time) {
valueAnimator = ValueAnimator.ofFloat(startF, endF);
valueAnimator.setDuration(time);
valueAnimator.setInterpolator(new LinearInterpolator());
valueAnimator.setRepeatCount(ValueAnimator.INFINITE);
valueAnimator.setRepeatMode(ValueAnimator.RESTART);
valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
mAnimatedValue = (float) valueAnimator.getAnimatedValue();
postInvalidate();
}
});
if (!valueAnimator.isRunning()) {
valueAnimator.start();
}
return valueAnimator;
}
use of android.view.animation.LinearInterpolator in project TastyToast by yadav-rahul.
the class ErrorToastView method startViewAnim.
private ValueAnimator startViewAnim(float startF, final float endF, long time) {
valueAnimator = ValueAnimator.ofFloat(startF, endF);
valueAnimator.setDuration(time);
valueAnimator.setInterpolator(new LinearInterpolator());
valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
mAnimatedValue = (float) valueAnimator.getAnimatedValue();
if (mAnimatedValue < 0.5) {
isSad = false;
isJustVisible = false;
endAngle = 240 * (mAnimatedValue);
isJustVisible = true;
} else if (mAnimatedValue > 0.55 && mAnimatedValue < 0.7) {
endAngle = 120;
isSad = false;
isJustVisible = true;
} else {
endAngle = 120;
isSad = true;
isJustVisible = false;
}
postInvalidate();
}
});
if (!valueAnimator.isRunning()) {
valueAnimator.start();
}
return valueAnimator;
}
use of android.view.animation.LinearInterpolator in project TastyToast by yadav-rahul.
the class SuccessToastView method startViewAnim.
private ValueAnimator startViewAnim(float startF, final float endF, long time) {
valueAnimator = ValueAnimator.ofFloat(startF, endF);
valueAnimator.setDuration(time);
valueAnimator.setInterpolator(new LinearInterpolator());
valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
mAnimatedValue = (float) valueAnimator.getAnimatedValue();
if (mAnimatedValue < 0.5) {
isSmileLeft = false;
isSmileRight = false;
endAngle = -360 * (mAnimatedValue);
} else if (mAnimatedValue > 0.55 && mAnimatedValue < 0.7) {
endAngle = -180;
isSmileLeft = true;
isSmileRight = false;
} else {
endAngle = -180;
isSmileLeft = true;
isSmileRight = true;
}
postInvalidate();
}
});
if (!valueAnimator.isRunning()) {
valueAnimator.start();
}
return valueAnimator;
}
Aggregations