use of android.view.animation.BounceInterpolator in project Android-Developers-Samples by johnjohndoe.
the class DefaultCardStreamAnimator method getSwipeInAnimator.
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override
public ObjectAnimator getSwipeInAnimator(View view, float deltaX, float deltaY) {
float deltaXAbs = Math.abs(deltaX);
float fractionCovered = 1.f - (deltaXAbs / view.getWidth());
long duration = Math.abs((int) ((1 - fractionCovered) * 200 * mSpeedFactor));
// Animate position and alpha of swiped item
ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(view, PropertyValuesHolder.ofFloat("alpha", 1.f), PropertyValuesHolder.ofFloat("translationX", 0.f), PropertyValuesHolder.ofFloat("rotationY", 0.f));
animator.setDuration(duration).setInterpolator(new BounceInterpolator());
return animator;
}
use of android.view.animation.BounceInterpolator in project MaterialDesignLibrary by navasmdc.
the class ButtonFloat method show.
public void show() {
ObjectAnimator animator = ObjectAnimator.ofFloat(ButtonFloat.this, "y", showPosition);
animator.setInterpolator(new BounceInterpolator());
animator.setDuration(1500);
animator.start();
isShow = true;
}
use of android.view.animation.BounceInterpolator in project WaveSwipeRefreshLayout by recruit-lifestyle.
the class WaveView method startWaveAnimation.
/**
* @param h 波が始まる高さ
*/
public void startWaveAnimation(float h) {
h = Math.min(h, MAX_WAVE_HEIGHT) * mWidth;
mWaveReverseAnimator = ValueAnimator.ofFloat(h, 0.f);
mWaveReverseAnimator.setDuration(WAVE_ANIMATOR_DURATION);
mWaveReverseAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
float h = (Float) valueAnimator.getAnimatedValue();
mWavePath.moveTo(0, 0);
mWavePath.quadTo(0.25f * mWidth, 0, 0.333f * mWidth, h * 0.5f);
mWavePath.quadTo(mWidth * 0.5f, h * 1.4f, 0.666f * mWidth, h * 0.5f);
mWavePath.quadTo(0.75f * mWidth, 0, mWidth, 0);
postInvalidate();
}
});
mWaveReverseAnimator.setInterpolator(new BounceInterpolator());
mWaveReverseAnimator.start();
}
use of android.view.animation.BounceInterpolator in project Android-MaterialRefreshLayout by android-cjj.
the class MaterialWaveView method onRefreshing.
@Override
public void onRefreshing(MaterialRefreshLayout br) {
setHeadHeight((int) (Util.dip2px(getContext(), DefaulHeadHeight)));
ValueAnimator animator = ValueAnimator.ofInt(getWaveHeight(), 0);
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
Log.i("anim", "value--->" + (int) animation.getAnimatedValue());
setWaveHeight((int) animation.getAnimatedValue());
invalidate();
}
});
animator.setInterpolator(new BounceInterpolator());
animator.setDuration(200);
animator.start();
}
use of android.view.animation.BounceInterpolator in project HTextView by hanks-zyh.
the class AnvilText method drawFrame.
@Override
protected void drawFrame(Canvas canvas) {
float offset = startX;
float oldOffset = oldStartX;
int maxLength = Math.max(mText.length(), mOldText.length());
float percent = progress;
boolean showSmoke = false;
for (int i = 0; i < maxLength; i++) {
// draw old text
if (i < mOldText.length()) {
mOldPaint.setTextSize(mTextSize);
int move = CharacterUtils.needMove(i, differentList);
if (move != -1) {
mOldPaint.setAlpha(255);
float p = percent * 2f;
p = p > 1 ? 1 : p;
float distX = CharacterUtils.getOffset(i, move, p, startX, oldStartX, gaps, oldGaps);
canvas.drawText(mOldText.charAt(i) + "", 0, 1, distX, startY, mOldPaint);
} else {
float p = percent * 2f;
p = p > 1 ? 1 : p;
mOldPaint.setAlpha((int) ((1 - p) * 255));
canvas.drawText(mOldText.charAt(i) + "", 0, 1, oldOffset, startY, mOldPaint);
}
oldOffset += oldGaps[i];
}
// draw new text
if (i < mText.length()) {
if (!CharacterUtils.stayHere(i, differentList)) {
showSmoke = true;
float interpolation = new BounceInterpolator().getInterpolation(percent);
mPaint.setAlpha(255);
mPaint.setTextSize(mTextSize);
float y = startY - (1 - interpolation) * mTextHeight * 2;
float width = mPaint.measureText(mText.charAt(i) + "");
canvas.drawText(mText.charAt(i) + "", 0, 1, offset + (gaps[i] - width) / 2, y, mPaint);
}
offset += gaps[i];
}
}
if (percent > 0.3 && percent < 1) {
if (showSmoke) {
drawSmokes(canvas, startX + (offset - startX) / 2f, startY - 50, percent);
}
}
}
Aggregations