android.animation.FloatEvaluator Java Examples
The following examples show how to use
android.animation.FloatEvaluator.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SpaceExplorerFragment.java From ScrollingBackgroundView with Apache License 2.0 | 6 votes |
private void animate() { if (mValueAnimator == null || !mValueAnimator.isRunning()) { final ScrollingBackgroundView backgroundView = scrollingBackgroundView(); mValueAnimator = ValueAnimator.ofFloat(.0F, 1.F); mValueAnimator.setRepeatCount(ValueAnimator.INFINITE); mValueAnimator.setRepeatMode(ValueAnimator.RESTART); mValueAnimator.setEvaluator(new FloatEvaluator()); mValueAnimator.setInterpolator(new LinearInterpolator()); mValueAnimator.setDuration(400L); mValueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { final int x = (int) (mHorizontalStep * mSpeed + .5F); final int y = (int) (mVerticalStep * mSpeed + .5F); backgroundView.scrollBy(x, y); mShipView.setRotation(shipRotation(x, y)); } }); mValueAnimator.start(); } }
Example #2
Source File: ParallaxFragment.java From ScrollingBackgroundView with Apache License 2.0 | 6 votes |
private void setUp(final ScrollingBackgroundView view, final int step, final float speed) { view.postOnAnimation(new Runnable() { @Override public void run() { final ValueAnimator animator = ValueAnimator.ofFloat(.0F, 1.F); animator.setEvaluator(new FloatEvaluator()); animator.setDuration(400L); animator.setRepeatMode(ValueAnimator.RESTART); animator.setRepeatCount(ValueAnimator.INFINITE); animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { view.scrollBy( (int) (step * speed + .5F), 0 ); } }); animator.start(); } }); }
Example #3
Source File: RecordFragment.java From Android-AudioRecorder-App with Apache License 2.0 | 6 votes |
private void initViews(View recordView) { chronometer = recordView.findViewById(R.id.chronometer); audioVisualization = recordView.findViewById(R.id.visualizer_view); mSettingsButton = recordView.findViewById(R.id.settings_btn); mPlayListBtn = recordView.findViewById(R.id.play_list_btn); mRecordButton = recordView.findViewById(R.id.btnRecord); mPauseButton = recordView.findViewById(R.id.btnPause); mPauseButton.setVisibility(View.GONE); //hide pause button before recording starts alphaAnimator = ObjectAnimator.ofObject(chronometer, "alpha", new FloatEvaluator(), 0.2f); alphaAnimator.setRepeatMode(ValueAnimator.REVERSE); alphaAnimator.setRepeatCount(ValueAnimator.INFINITE); audioRecordPresenter.onViewInitialised(); }
Example #4
Source File: Great.java From SmileyRating with Apache License 2.0 | 6 votes |
public Great() { super(-135, 360); // Create mouth float div = 0.10f; FloatEvaluator f = new FloatEvaluator(); createMirrorSmile(new Point(0.5f, 0.5f), new Point(f.evaluate(div, CENTER_SMILE * 0.295, CENTER_SMILE), f.evaluate(div, MOUTH_CENTER_Y - (CENTER_SMILE * 0.23), MOUTH_CENTER_Y)), // Top control new Point(f.evaluate(div, CENTER_SMILE * 0.295, CENTER_SMILE), f.evaluate(div, MOUTH_CENTER_Y - (CENTER_SMILE * 0.088), MOUTH_CENTER_Y)), // Bottom control new Point(f.evaluate(div, CENTER_SMILE * 0.591, CENTER_SMILE), f.evaluate(div, MOUTH_CENTER_Y - (CENTER_SMILE * 0.23), MOUTH_CENTER_Y)), // Top Point new Point(f.evaluate(div, CENTER_SMILE * 0.591, CENTER_SMILE), f.evaluate(div, MOUTH_CENTER_Y + (CENTER_SMILE * 0.118), MOUTH_CENTER_Y)) // Bottom point ); setup( getClass().getSimpleName(), Color.parseColor("#f2dd68"), Color.parseColor("#353431") ); }
Example #5
Source File: Good.java From SmileyRating with Apache License 2.0 | 6 votes |
public Good() { super(-135, 360); float div = 0.20f; FloatEvaluator f = new FloatEvaluator(); createMirrorSmile(new Point(CENTER_SMILE, MOUTH_CENTER_Y), new Point(f.evaluate(div, CENTER_SMILE * 0.414, CENTER_SMILE), f.evaluate(div, MOUTH_CENTER_Y - (CENTER_SMILE * 0.24), MOUTH_CENTER_Y)), // Top control new Point(f.evaluate(div, CENTER_SMILE * 0.355, CENTER_SMILE), f.evaluate(div, MOUTH_CENTER_Y - (CENTER_SMILE * 0.029), MOUTH_CENTER_Y)), // Bottom control new Point(f.evaluate(div, CENTER_SMILE * 0.65, CENTER_SMILE), f.evaluate(div, MOUTH_CENTER_Y - (CENTER_SMILE * 0.118), MOUTH_CENTER_Y)), // Top Point new Point(f.evaluate(div, CENTER_SMILE * 0.591, CENTER_SMILE), f.evaluate(div, MOUTH_CENTER_Y + (CENTER_SMILE * 0.118), MOUTH_CENTER_Y)) // Bottom point ); setup( getClass().getSimpleName(), Color.parseColor("#f2dd68"), Color.parseColor("#353431") ); }
Example #6
Source File: Bad.java From SmileyRating with Apache License 2.0 | 6 votes |
public Bad() { super(-90, 270); float div = 0.20f; FloatEvaluator f = new FloatEvaluator(); createMirrorInverseSmile(new Point(CENTER_SMILE, MOUTH_CENTER_Y), new Point(f.evaluate(div, CENTER_SMILE * 0.414, CENTER_SMILE), f.evaluate(div, MOUTH_CENTER_Y - (CENTER_SMILE * 0.24), MOUTH_CENTER_Y)), // Top control new Point(f.evaluate(div, CENTER_SMILE * 0.355, CENTER_SMILE), f.evaluate(div, MOUTH_CENTER_Y - (CENTER_SMILE * 0.029), MOUTH_CENTER_Y)), // Bottom control new Point(f.evaluate(div, CENTER_SMILE * 0.65, CENTER_SMILE), f.evaluate(div, MOUTH_CENTER_Y - (CENTER_SMILE * 0.118), MOUTH_CENTER_Y)), // Top Point new Point(f.evaluate(div, CENTER_SMILE * 0.591, CENTER_SMILE), f.evaluate(div, MOUTH_CENTER_Y + (CENTER_SMILE * 0.118), MOUTH_CENTER_Y)) // Bottom point ); setup( getClass().getSimpleName(), Color.parseColor("#f2dd68"), Color.parseColor("#353431") ); }
Example #7
Source File: Terrible.java From SmileyRating with Apache License 2.0 | 6 votes |
public Terrible() { super(-35, 280); float div = 0.20f; FloatEvaluator f = new FloatEvaluator(); createMirrorInverseSmile(new Point(CENTER_SMILE, MOUTH_CENTER_Y), new Point(f.evaluate(div, CENTER_SMILE * 0.414, CENTER_SMILE), f.evaluate(div, MOUTH_CENTER_Y - (CENTER_SMILE * 0.24), MOUTH_CENTER_Y)), // Top control new Point(f.evaluate(div, CENTER_SMILE * 0.355, CENTER_SMILE), f.evaluate(div, MOUTH_CENTER_Y - (CENTER_SMILE * 0.029), MOUTH_CENTER_Y)), // Bottom control new Point(f.evaluate(div, CENTER_SMILE * 0.65, CENTER_SMILE), f.evaluate(div, MOUTH_CENTER_Y - (CENTER_SMILE * 0.118), MOUTH_CENTER_Y)), // Top Point new Point(f.evaluate(div, CENTER_SMILE * 0.591, CENTER_SMILE), f.evaluate(div, MOUTH_CENTER_Y + (CENTER_SMILE * 0.118), MOUTH_CENTER_Y)) // Bottom point ); setup( getClass().getSimpleName(), Color.parseColor("#f29a68"), Color.parseColor("#353431") ); }
Example #8
Source File: CircularProgressView.java From NaviBee with GNU General Public License v3.0 | 5 votes |
private ValueAnimator getAnimator(double current, double next, long duration, ValueAnimator.AnimatorUpdateListener updateListener) { ValueAnimator animator = new ValueAnimator(); animator.setInterpolator(mInterpolator); animator.setDuration(duration); animator.setObjectValues(current, next); animator.setEvaluator(new FloatEvaluator() { public Integer evaluate(float fraction, float startValue, float endValue) { return Math.round(startValue + (endValue - startValue) * fraction); } }); animator.addUpdateListener(updateListener); return animator; }
Example #9
Source File: FloatingActionButtonImpl.java From material-components-android with Apache License 2.0 | 5 votes |
/** * There appears to be a bug in the OpenGL shadow rendering code on API 26. We can work around it * by preventing any scaling close to 0. */ private void workAroundOreoBug(final ObjectAnimator animator) { if (Build.VERSION.SDK_INT != Build.VERSION_CODES.O) { return; } animator.setEvaluator(new TypeEvaluator<Float>() { FloatEvaluator floatEvaluator = new FloatEvaluator(); @Override public Float evaluate(float fraction, Float startValue, Float endValue) { float evaluated = floatEvaluator.evaluate(fraction, startValue, endValue); return evaluated < 0.1f ? 0.0f : evaluated; } }); }
Example #10
Source File: AirQualityViewHolder.java From GeometricWeather with GNU Lesser General Public License v3.0 | 5 votes |
@SuppressLint("DefaultLocale") @Override public void onEnterScreen() { if (itemAnimationEnabled && enable && weather != null) { int aqiColor = weather.getCurrent().getAirQuality().getAqiColor(progress.getContext()); ValueAnimator progressColor = ValueAnimator.ofObject( new ArgbEvaluator(), ContextCompat.getColor(context, R.color.colorLevel_1), aqiColor ); progressColor.addUpdateListener(animation -> progress.setProgressColor( (Integer) animation.getAnimatedValue(), themeManager.isLightTheme())); ValueAnimator backgroundColor = ValueAnimator.ofObject( new ArgbEvaluator(), themeManager.getLineColor(context), ColorUtils.setAlphaComponent(aqiColor, (int) (255 * 0.1)) ); backgroundColor.addUpdateListener(animation -> progress.setArcBackgroundColor((Integer) animation.getAnimatedValue()) ); ValueAnimator aqiNumber = ValueAnimator.ofObject(new FloatEvaluator(), 0, aqiIndex); aqiNumber.addUpdateListener(animation -> { progress.setProgress((Float) animation.getAnimatedValue()); progress.setText(String.format("%d", (int) progress.getProgress())); }); attachAnimatorSet = new AnimatorSet(); attachAnimatorSet.playTogether(progressColor, backgroundColor, aqiNumber); attachAnimatorSet.setInterpolator(new DecelerateInterpolator()); attachAnimatorSet.setDuration((long) (1500 + aqiIndex / 400f * 1500)); attachAnimatorSet.start(); adapter.executeAnimation(); } }
Example #11
Source File: AqiAdapter.java From GeometricWeather with GNU Lesser General Public License v3.0 | 5 votes |
void executeAnimation() { if (executeAnimation && item != null) { executeAnimation = false; ValueAnimator progressColor = ValueAnimator.ofObject( new ArgbEvaluator(), ContextCompat.getColor(itemView.getContext(), R.color.colorLevel_1), item.color ); progressColor.addUpdateListener(animation -> progress.setProgressColor((Integer) animation.getAnimatedValue()) ); ValueAnimator backgroundColor = ValueAnimator.ofObject( new ArgbEvaluator(), themeManager.getLineColor(itemView.getContext()), ColorUtils.setAlphaComponent(item.color, (int) (255 * 0.1)) ); backgroundColor.addUpdateListener(animation -> progress.setProgressBackgroundColor((Integer) animation.getAnimatedValue()) ); ValueAnimator aqiNumber = ValueAnimator.ofObject(new FloatEvaluator(), 0, item.progress); aqiNumber.addUpdateListener(animation -> progress.setProgress( 100.0f * ((Float) animation.getAnimatedValue()) / item.max ) ); attachAnimatorSet = new AnimatorSet(); attachAnimatorSet.playTogether(progressColor, backgroundColor, aqiNumber); attachAnimatorSet.setInterpolator(new DecelerateInterpolator(3)); attachAnimatorSet.setDuration((long) (item.progress / item.max * 5000)); attachAnimatorSet.start(); } }
Example #12
Source File: Speaker.java From FuckingVolumeSlider with GNU General Public License v3.0 | 5 votes |
private void createBigWawe(float centerX, float centerY) { float fraction = 0.2f; FloatEvaluator evaluator = new FloatEvaluator(); Point rightControll = new Point(evaluator.evaluate(fraction, centerX, centerX * 1.45), centerY); Point rightPoint = new Point(evaluator.evaluate(fraction, centerX * 0.95, centerX), evaluator.evaluate(fraction, centerY * 0.35, centerY)); Wawe wawe = createWawe( rightControll, //right controll new Point(rightControll.x - gap * 0.45f, centerY), //left controll rightPoint, //right point new Point(rightPoint.x - gap * 0.7f, rightPoint.y), //left point new Point(rightPoint.x - gap * 0.4f, rightPoint.y - gap * 0.6f), //top right controll new Point(rightPoint.x - gap * 0.9f, rightPoint.y - gap * 0.4f) //top left controll ); wawes.put(1, wawe); }
Example #13
Source File: Speaker.java From FuckingVolumeSlider with GNU General Public License v3.0 | 5 votes |
private void createSmallWawe(float centerX, float centerY) { float fraction = 0.2f; FloatEvaluator evaluator = new FloatEvaluator(); Point rightControll = new Point(evaluator.evaluate(fraction, centerX, centerX * 1.45), centerY); Point rightPoint = new Point(evaluator.evaluate(fraction, centerX * 0.95, centerX), evaluator.evaluate(fraction, centerY * 0.35 * 1.5, centerY)); Wawe wawe = createWawe( rightControll, //right controll new Point(rightControll.x - gap * 0.45f, centerY), //left controll rightPoint, //right point new Point(rightPoint.x - gap * 0.7f, rightPoint.y), //left point new Point(rightPoint.x - gap * 0.4f, rightPoint.y - gap * 0.6f), //top right controll new Point(rightPoint.x - gap * 0.9f, rightPoint.y - gap * 0.4f) //top left controll ); wawes.put(0, wawe); }
Example #14
Source File: BaseRating.java From SmileyRating with Apache License 2.0 | 5 votes |
private void createTerribleSmile() { float div = 0.20f; FloatEvaluator f = new FloatEvaluator(); createSmile(new Point(mCenterSmile, mCenterY), new Point(f.evaluate(div, mCenterSmile * 0.414, mCenterSmile), f.evaluate(div, mCenterY - (mCenterSmile * 0.24), mCenterY)), // Top control new Point(f.evaluate(div, mCenterSmile * 0.355, mCenterSmile), f.evaluate(div, mCenterY - (mCenterSmile * 0.029), mCenterY)), // Bottom control new Point(f.evaluate(div, mCenterSmile * 0.65, mCenterSmile), f.evaluate(div, mCenterY - (mCenterSmile * 0.118), mCenterY)), // Top Point new Point(f.evaluate(div, mCenterSmile * 0.591, mCenterSmile), f.evaluate(div, mCenterY + (mCenterSmile * 0.118), mCenterY)), // Bottom point Smile.MIRROR_INVERSE, TERRIBLE, -1f, -1f, -1f); }
Example #15
Source File: BaseRating.java From SmileyRating with Apache License 2.0 | 5 votes |
private void createBadSmile() { float div = 0.20f; FloatEvaluator f = new FloatEvaluator(); createSmile(new Point(mCenterSmile, mCenterY), new Point(f.evaluate(div, mCenterSmile * 0.414, mCenterSmile), f.evaluate(div, mCenterY - (mCenterSmile * 0.24), mCenterY)), // Top control new Point(f.evaluate(div, mCenterSmile * 0.355, mCenterSmile), f.evaluate(div, mCenterY - (mCenterSmile * 0.029), mCenterY)), // Bottom control new Point(f.evaluate(div, mCenterSmile * 0.65, mCenterSmile), f.evaluate(div, mCenterY - (mCenterSmile * 0.118), mCenterY)), // Top Point new Point(f.evaluate(div, mCenterSmile * 0.591, mCenterSmile), f.evaluate(div, mCenterY + (mCenterSmile * 0.118), mCenterY)), // Bottom point Smile.MIRROR_INVERSE, BAD, -1f, -1f, -1f); }
Example #16
Source File: BaseRating.java From SmileyRating with Apache License 2.0 | 5 votes |
private void createGreatSmile() { float div = 0.10f; FloatEvaluator f = new FloatEvaluator(); createSmile(new Point(mCenterSmile, mCenterY), new Point(f.evaluate(div, mCenterSmile * 0.295, mCenterSmile), f.evaluate(div, mCenterY - (mCenterSmile * 0.23), mCenterY)), // Top control new Point(f.evaluate(div, mCenterSmile * 0.295, mCenterSmile), f.evaluate(div, mCenterY - (mCenterSmile * 0.088), mCenterY)), // Bottom control new Point(f.evaluate(div, mCenterSmile * 0.591, mCenterSmile), f.evaluate(div, mCenterY - (mCenterSmile * 0.23), mCenterY)), // Top Point new Point(f.evaluate(div, mCenterSmile * 0.591, mCenterSmile), f.evaluate(div, mCenterY + (mCenterSmile * 0.118), mCenterY)), // Bottom point Smile.MIRROR, GREAT, -1f, -1f, -1f); }
Example #17
Source File: BottomFragment.java From NewFastFrame with Apache License 2.0 | 5 votes |
@Override protected void updateView() { intEvaluator = new IntEvaluator(); floatEvaluator = new FloatEvaluator(); int sameWidth = playOrPause.getLayoutParams().width; screenWidth = DensityUtil.getScreenWidth(getContext()); screenHeight = DensityUtil.getScreenHeight(getContext()); int margin = ((RelativeLayout.LayoutParams) playOrPause.getLayoutParams()).rightMargin; endPlay = screenWidth / 2 - (sameWidth * 2 + margin) + sameWidth / 2; }
Example #18
Source File: MenuItemsSectionSpec.java From litho with Apache License 2.0 | 5 votes |
private static DynamicValue<Float> createTranslationXDynamicValue( SectionContext c, final int tileIndex, DynamicValue<Float> expandedAmount) { final @Dimension int tileWidthWithSpacing = c.getResourceResolver().dipsToPixels(55); final FloatEvaluator floatEvaluator = new FloatEvaluator(); return new DerivedDynamicValue<>( expandedAmount, new DerivedDynamicValue.Modifier<Float, Float>() { @Override public Float modify(Float in) { return floatEvaluator.evaluate(in, -tileWidthWithSpacing * (tileIndex + 1), 0); } }); }
Example #19
Source File: ExpandingPickerComponentSpec.java From litho with Apache License 2.0 | 5 votes |
private static final Animator createExpandCollapseAnimator( final boolean expand, final DynamicValue<Float> expandedAmount, final DynamicValue<Float> contractButtonRotation, final DynamicValue<Float> contractButtonScale, final DynamicValue<Float> contractButtonAlpha, final DynamicValue<Float> expandButtonScale, final DynamicValue<Float> expandButtonAlpha, final DynamicValue<Float> menuButtonAlpha) { final float from = expandedAmount.get(); final float to = expand ? 1 : 0; final ValueAnimator expandCollapseAnimator = ValueAnimator.ofFloat(from, to); expandCollapseAnimator.setDuration(EXPAND_COLLAPSE_DURATION_MS); final FloatEvaluator floatEvaluator = new FloatEvaluator(); expandCollapseAnimator.addUpdateListener( new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { float animatedValue = (Float) animation.getAnimatedValue(); expandedAmount.set(animatedValue); contractButtonRotation.set(floatEvaluator.evaluate(animatedValue, -90, 0)); contractButtonScale.set(floatEvaluator.evaluate(animatedValue, .7, 1)); contractButtonAlpha.set(floatEvaluator.evaluate(animatedValue, 0, 1)); expandButtonScale.set(floatEvaluator.evaluate(animatedValue, 1, 0.7)); expandButtonAlpha.set(floatEvaluator.evaluate(animatedValue, 1, 0)); menuButtonAlpha.set(floatEvaluator.evaluate(animatedValue, 0, 1)); } }); return expandCollapseAnimator; }
Example #20
Source File: ContinuousExampleComponentSpec.java From litho with Apache License 2.0 | 5 votes |
private static Animator createRotationAnimator(final DynamicValue<Float> rotation) { final TimeAnimator animator = new TimeAnimator(); final FloatEvaluator floatEvaluator = new FloatEvaluator(); animator.setTimeListener( new TimeAnimator.TimeListener() { @Override public void onTimeUpdate(TimeAnimator animation, long totalTime, long deltaTime) { float fraction = Float.valueOf(totalTime % ANIMATION_DURATION_MS) / ANIMATION_DURATION_MS; rotation.set(fraction * 360); } }); return animator; }
Example #21
Source File: LQRRefreshButton.java From LQRBiliBlili with MIT License | 5 votes |
public LQRRefreshButton(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); // 获取自定义属性值 TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.LQRRefreshButton); borderColor = ta.getColor(R.styleable.LQRRefreshButton_refresh_btn_borderColor, Color.parseColor("#fb7299")); borderWidth = ta.getDimension(R.styleable.LQRRefreshButton_refresh_btn_borderWidth, dipToPx(0)); borderRadius = ta.getDimension(R.styleable.LQRRefreshButton_refresh_btn_borderRadius, dipToPx(60)); text = ta.getString(R.styleable.LQRRefreshButton_refresh_btn_text); if (text == null) text = ""; textColor = ta.getColor(R.styleable.LQRRefreshButton_refresh_btn_textColor, Color.parseColor("#fb7299")); textSize = ta.getDimension(R.styleable.LQRRefreshButton_refresh_btn_textSize, spToPx(14)); iconSrc = ta.getResourceId(R.styleable.LQRRefreshButton_refresh_btn_iconSrc, R.mipmap.tag_center_refresh_icon); iconSize = ta.getDimension(R.styleable.LQRRefreshButton_refresh_btn_iconSize, dipToPx(14)); space4TextAndIcon = ta.getDimension(R.styleable.LQRRefreshButton_refresh_btn_space4TextAndIcon, dipToPx(10)); ta.recycle(); // icon iconBitmap = BitmapFactory.decodeResource(getResources(), iconSrc); iconBitmap = zoomImg(iconBitmap, iconSize, iconSize); // 旋转动画 mAnimator = ObjectAnimator.ofObject(this, "degress", new FloatEvaluator(), 360, 0); mAnimator.setDuration(2000); mAnimator.setRepeatMode(ObjectAnimator.RESTART); mAnimator.setInterpolator(new LinearInterpolator()); mAnimator.setRepeatCount(ObjectAnimator.INFINITE); }
Example #22
Source File: BaseRating.java From SmileyRating with Apache License 2.0 | 5 votes |
private void createGoodSmile() { float div = 0.20f; FloatEvaluator f = new FloatEvaluator(); createSmile(new Point(mCenterSmile, mCenterY), new Point(f.evaluate(div, mCenterSmile * 0.414, mCenterSmile), f.evaluate(div, mCenterY - (mCenterSmile * 0.24), mCenterY)), // Top control new Point(f.evaluate(div, mCenterSmile * 0.355, mCenterSmile), f.evaluate(div, mCenterY - (mCenterSmile * 0.029), mCenterY)), // Bottom control new Point(f.evaluate(div, mCenterSmile * 0.65, mCenterSmile), f.evaluate(div, mCenterY - (mCenterSmile * 0.118), mCenterY)), // Top Point new Point(f.evaluate(div, mCenterSmile * 0.591, mCenterSmile), f.evaluate(div, mCenterY + (mCenterSmile * 0.118), mCenterY)), // Bottom point Smile.MIRROR, GOOD, -1f, -1f, -1f); }
Example #23
Source File: AnimUtil.java From PopupCircleMenu with MIT License | 4 votes |
public static ObjectAnimator toAlphaOne(View view, int duration) { ObjectAnimator objectAnimator = ObjectAnimator.ofObject(view, "alpha", new FloatEvaluator(), 0.0f, 1.0f); objectAnimator.setDuration(duration); return objectAnimator; }
Example #24
Source File: RevealRectangularShapeAnimator.java From hintcase with Apache License 2.0 | 4 votes |
private void init() { floatEvaluator = new FloatEvaluator(); }
Example #25
Source File: UnrevealRectangularShapeAnimator.java From hintcase with Apache License 2.0 | 4 votes |
private void init() { floatEvaluator = new FloatEvaluator(); }
Example #26
Source File: AnimUtil.java From PopupCircleMenu with MIT License | 4 votes |
public static ObjectAnimator toAlphaZero(View view, int duration) { ObjectAnimator objectAnimator = ObjectAnimator.ofObject(view, "alpha", new FloatEvaluator(), 1.0f, 0f); objectAnimator.setDuration(duration); return objectAnimator; }
Example #27
Source File: AstroViewHolder.java From GeometricWeather with GNU Lesser General Public License v3.0 | 4 votes |
@Override public void onEnterScreen() { if (itemAnimationEnabled && weather != null) { ValueAnimator timeDay = ValueAnimator.ofObject(new FloatEvaluator(), startTimes[0], currentTimes[0]); timeDay.addUpdateListener(animation -> { animCurrentTimes[0] = (Float) animation.getAnimatedValue(); sunMoonView.setTime(startTimes, endTimes, animCurrentTimes); }); double totalRotationDay = 360.0 * 7 * (currentTimes[0] - startTimes[0]) / (endTimes[0] - startTimes[0]); ValueAnimator rotateDay = ValueAnimator.ofObject( new FloatEvaluator(), 0, (int) (totalRotationDay - totalRotationDay % 360) ); rotateDay.addUpdateListener(animation -> sunMoonView.setDayIndicatorRotation((Float) animation.getAnimatedValue()) ); attachAnimatorSets[0] = new AnimatorSet(); attachAnimatorSets[0].playTogether(timeDay, rotateDay); attachAnimatorSets[0].setInterpolator(new OvershootInterpolator(1f)); attachAnimatorSets[0].setDuration(getPathAnimatorDuration(0)); attachAnimatorSets[0].start(); ValueAnimator timeNight = ValueAnimator.ofObject(new FloatEvaluator(), startTimes[1], currentTimes[1]); timeNight.addUpdateListener(animation -> { animCurrentTimes[1] = (Float) animation.getAnimatedValue(); sunMoonView.setTime(startTimes, endTimes, animCurrentTimes); }); double totalRotationNight = 360.0 * 4 * (currentTimes[1] - startTimes[1]) / (endTimes[1] - startTimes[1]); ValueAnimator rotateNight = ValueAnimator.ofObject( new FloatEvaluator(), 0, (int) (totalRotationNight - totalRotationNight % 360) ); rotateNight.addUpdateListener(animation -> sunMoonView.setNightIndicatorRotation(-1 * (Float) animation.getAnimatedValue()) ); attachAnimatorSets[1] = new AnimatorSet(); attachAnimatorSets[1].playTogether(timeNight, rotateNight); attachAnimatorSets[1].setInterpolator(new OvershootInterpolator(1f)); attachAnimatorSets[1].setDuration(getPathAnimatorDuration(1)); attachAnimatorSets[1].start(); if (phaseAngle > 0) { ValueAnimator moonAngle = ValueAnimator.ofObject(new FloatEvaluator(), 0, phaseAngle); moonAngle.addUpdateListener(animation -> phaseView.setSurfaceAngle((Float) animation.getAnimatedValue()) ); attachAnimatorSets[2] = new AnimatorSet(); attachAnimatorSets[2].playTogether(moonAngle); attachAnimatorSets[2].setInterpolator(new DecelerateInterpolator()); attachAnimatorSets[2].setDuration(getPhaseAnimatorDuration()); attachAnimatorSets[2].start(); } } }
Example #28
Source File: BaseRating.java From SmileyRating with Apache License 2.0 | 4 votes |
protected Path transformSmile(float trans, float fraction, Path path, Smile s1, Smile s2, FloatEvaluator evaluator) { path.reset(); path.moveTo( evaluator.evaluate(fraction, s1.START_POINT.x, s2.START_POINT.x) + trans, evaluator.evaluate(fraction, s1.START_POINT.y, s2.START_POINT.y) ); path.cubicTo( evaluator.evaluate(fraction, s1.TOP_CURVE[0].x, s2.TOP_CURVE[0].x) + trans, evaluator.evaluate(fraction, s1.TOP_CURVE[0].y, s2.TOP_CURVE[0].y), evaluator.evaluate(fraction, s1.TOP_CURVE[1].x, s2.TOP_CURVE[1].x) + trans, evaluator.evaluate(fraction, s1.TOP_CURVE[1].y, s2.TOP_CURVE[1].y), evaluator.evaluate(fraction, s1.TOP_CURVE[2].x, s2.TOP_CURVE[2].x) + trans, evaluator.evaluate(fraction, s1.TOP_CURVE[2].y, s2.TOP_CURVE[2].y) ); path.cubicTo( evaluator.evaluate(fraction, s1.RIGHT_CURVE[0].x, s2.RIGHT_CURVE[0].x) + trans, evaluator.evaluate(fraction, s1.RIGHT_CURVE[0].y, s2.RIGHT_CURVE[0].y), evaluator.evaluate(fraction, s1.RIGHT_CURVE[1].x, s2.RIGHT_CURVE[1].x) + trans, evaluator.evaluate(fraction, s1.RIGHT_CURVE[1].y, s2.RIGHT_CURVE[1].y), evaluator.evaluate(fraction, s1.RIGHT_CURVE[2].x, s2.RIGHT_CURVE[2].x) + trans, evaluator.evaluate(fraction, s1.RIGHT_CURVE[2].y, s2.RIGHT_CURVE[2].y) ); path.cubicTo( evaluator.evaluate(fraction, s1.BOTTOM_CURVE[0].x, s2.BOTTOM_CURVE[0].x) + trans, evaluator.evaluate(fraction, s1.BOTTOM_CURVE[0].y, s2.BOTTOM_CURVE[0].y), evaluator.evaluate(fraction, s1.BOTTOM_CURVE[1].x, s2.BOTTOM_CURVE[1].x) + trans, evaluator.evaluate(fraction, s1.BOTTOM_CURVE[1].y, s2.BOTTOM_CURVE[1].y), evaluator.evaluate(fraction, s1.BOTTOM_CURVE[2].x, s2.BOTTOM_CURVE[2].x) + trans, evaluator.evaluate(fraction, s1.BOTTOM_CURVE[2].y, s2.BOTTOM_CURVE[2].y) ); path.cubicTo( evaluator.evaluate(fraction, s1.LEFT_CURVE[0].x, s2.LEFT_CURVE[0].x) + trans, evaluator.evaluate(fraction, s1.LEFT_CURVE[0].y, s2.LEFT_CURVE[0].y), evaluator.evaluate(fraction, s1.LEFT_CURVE[1].x, s2.LEFT_CURVE[1].x) + trans, evaluator.evaluate(fraction, s1.LEFT_CURVE[1].y, s2.LEFT_CURVE[1].y), evaluator.evaluate(fraction, s1.LEFT_CURVE[2].x, s2.LEFT_CURVE[2].x) + trans, evaluator.evaluate(fraction, s1.LEFT_CURVE[2].y, s2.LEFT_CURVE[2].y) ); path.close(); return path; }
Example #29
Source File: ViewOtherAnimationBuilder.java From scene with Apache License 2.0 | 4 votes |
public T boundsRadius(float fromValue, float toValue) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { hashMap.put(BOUNDS_RADIUS, new Holder(new FloatEvaluator(), fromValue, toValue)); } return (T) this; }
Example #30
Source File: SimpleMenuAnimation.java From MaterialPreference with Apache License 2.0 | 4 votes |
@SuppressWarnings("unchecked") private static Animator createElevationAnimator(View view, float elevation) { Animator animator = ObjectAnimator.ofObject(view, View.TRANSLATION_Z, (TypeEvaluator) new FloatEvaluator(), -elevation, 0f); animator.setInterpolator(new FastOutSlowInInterpolator()); return animator; }