use of android.view.RenderNodeAnimator in project android_frameworks_base by ResurrectionRemix.
the class KeyguardAffordanceView method startRtAlphaFadeIn.
/**
* Fades in the Circle on the RenderThread. It's used when finishing the circle when it had
* alpha 0 in the beginning.
*/
private void startRtAlphaFadeIn() {
if (mCircleRadius == 0 && mPreviewView == null) {
Paint modifiedPaint = new Paint(mCirclePaint);
modifiedPaint.setColor(mCircleColor);
modifiedPaint.setAlpha(0);
mHwCirclePaint = CanvasProperty.createPaint(modifiedPaint);
RenderNodeAnimator animator = new RenderNodeAnimator(mHwCirclePaint, RenderNodeAnimator.PAINT_ALPHA, 255);
animator.setTarget(this);
animator.setInterpolator(Interpolators.ALPHA_IN);
animator.setDuration(250);
animator.start();
}
}
use of android.view.RenderNodeAnimator in project android_frameworks_base by ResurrectionRemix.
the class KeyguardAffordanceView method getRtAnimatorToRadius.
private Animator getRtAnimatorToRadius(float circleRadius) {
RenderNodeAnimator animator = new RenderNodeAnimator(mHwCircleRadius, circleRadius);
animator.setTarget(this);
return animator;
}
use of android.view.RenderNodeAnimator in project android_frameworks_base by ResurrectionRemix.
the class RippleForeground method createHardwareExit.
@Override
protected RenderNodeAnimatorSet createHardwareExit(Paint p) {
final int radiusDuration;
final int originDuration;
final int opacityDuration;
if (mIsBounded) {
computeBoundedTargetValues();
radiusDuration = BOUNDED_RADIUS_EXIT_DURATION;
originDuration = BOUNDED_ORIGIN_EXIT_DURATION;
opacityDuration = BOUNDED_OPACITY_EXIT_DURATION;
} else {
radiusDuration = getRadiusExitDuration();
originDuration = radiusDuration;
opacityDuration = getOpacityExitDuration();
}
final float startX = getCurrentX();
final float startY = getCurrentY();
final float startRadius = getCurrentRadius();
p.setAlpha((int) (p.getAlpha() * mOpacity + 0.5f));
mPropPaint = CanvasProperty.createPaint(p);
mPropRadius = CanvasProperty.createFloat(startRadius);
mPropX = CanvasProperty.createFloat(startX);
mPropY = CanvasProperty.createFloat(startY);
final RenderNodeAnimator radius = new RenderNodeAnimator(mPropRadius, mTargetRadius);
radius.setDuration(radiusDuration);
radius.setInterpolator(DECELERATE_INTERPOLATOR);
final RenderNodeAnimator x = new RenderNodeAnimator(mPropX, mTargetX);
x.setDuration(originDuration);
x.setInterpolator(DECELERATE_INTERPOLATOR);
final RenderNodeAnimator y = new RenderNodeAnimator(mPropY, mTargetY);
y.setDuration(originDuration);
y.setInterpolator(DECELERATE_INTERPOLATOR);
final RenderNodeAnimator opacity = new RenderNodeAnimator(mPropPaint, RenderNodeAnimator.PAINT_ALPHA, 0);
opacity.setDuration(opacityDuration);
opacity.setInterpolator(LINEAR_INTERPOLATOR);
opacity.addListener(mAnimationListener);
final RenderNodeAnimatorSet set = new RenderNodeAnimatorSet();
set.add(radius);
set.add(opacity);
set.add(x);
set.add(y);
return set;
}
use of android.view.RenderNodeAnimator in project android_frameworks_base by ResurrectionRemix.
the class RippleBackground method createHardwareExit.
@Override
protected RenderNodeAnimatorSet createHardwareExit(Paint p) {
final RenderNodeAnimatorSet set = new RenderNodeAnimatorSet();
final int targetAlpha = p.getAlpha();
final int currentAlpha = (int) (mOpacity * targetAlpha + 0.5f);
p.setAlpha(currentAlpha);
mPropPaint = CanvasProperty.createPaint(p);
mPropRadius = CanvasProperty.createFloat(mTargetRadius);
mPropX = CanvasProperty.createFloat(0);
mPropY = CanvasProperty.createFloat(0);
final int fastEnterDuration = mIsBounded ? (int) ((1 - mOpacity) * OPACITY_ENTER_DURATION_FAST) : 0;
// Linear exit after enter is completed.
final RenderNodeAnimator exit = new RenderNodeAnimator(mPropPaint, RenderNodeAnimator.PAINT_ALPHA, 0);
exit.setInterpolator(LINEAR_INTERPOLATOR);
exit.setDuration(OPACITY_EXIT_DURATION);
if (fastEnterDuration > 0) {
exit.setStartDelay(fastEnterDuration);
exit.setStartValue(targetAlpha);
}
set.add(exit);
// Linear "fast" enter based on current opacity.
if (fastEnterDuration > 0) {
final RenderNodeAnimator enter = new RenderNodeAnimator(mPropPaint, RenderNodeAnimator.PAINT_ALPHA, targetAlpha);
enter.setInterpolator(LINEAR_INTERPOLATOR);
enter.setDuration(fastEnterDuration);
set.add(enter);
}
return set;
}
use of android.view.RenderNodeAnimator in project android_packages_apps_DUI by DirtyUnicorns.
the class SmartButtonRipple method enterHardware.
private void enterHardware() {
cancelAnimations();
mDrawingHardwareGlow = true;
setExtendStart(CanvasProperty.createFloat(getExtendSize() / 2));
final RenderNodeAnimator startAnim = new RenderNodeAnimator(getExtendStart(), getExtendSize() / 2 - GLOW_MAX_SCALE_FACTOR * getRippleSize() / 2);
startAnim.setDuration(ANIMATION_DURATION_SCALE);
startAnim.setInterpolator(mInterpolator);
startAnim.addListener(mAnimatorListener);
startAnim.setTarget(mTargetView);
setExtendEnd(CanvasProperty.createFloat(getExtendSize() / 2));
final RenderNodeAnimator endAnim = new RenderNodeAnimator(getExtendEnd(), getExtendSize() / 2 + GLOW_MAX_SCALE_FACTOR * getRippleSize() / 2);
endAnim.setDuration(ANIMATION_DURATION_SCALE);
endAnim.setInterpolator(mInterpolator);
endAnim.addListener(mAnimatorListener);
endAnim.setTarget(mTargetView);
if (isHorizontal()) {
mTopProp = CanvasProperty.createFloat(0f);
mBottomProp = CanvasProperty.createFloat(getBounds().height());
mRxProp = CanvasProperty.createFloat(getBounds().height() / 2);
mRyProp = CanvasProperty.createFloat(getBounds().height() / 2);
} else {
mLeftProp = CanvasProperty.createFloat(0f);
mRightProp = CanvasProperty.createFloat(getBounds().width());
mRxProp = CanvasProperty.createFloat(getBounds().width() / 2);
mRyProp = CanvasProperty.createFloat(getBounds().width() / 2);
}
mGlowScale = GLOW_MAX_SCALE_FACTOR;
mGlowAlpha = GLOW_MAX_ALPHA;
mRipplePaint = getRipplePaint();
mRipplePaint.setAlpha((int) (mGlowAlpha * 255));
mPaintProp = CanvasProperty.createPaint(mRipplePaint);
startAnim.start();
endAnim.start();
mRunningAnimations.add(startAnim);
mRunningAnimations.add(endAnim);
invalidateSelf();
}
Aggregations