use of android.view.animation.OvershootInterpolator in project react-native-navigation by wix.
the class PeekingAnimator method createSlideInAnimator.
private ObjectAnimator createSlideInAnimator(View view, int offset) {
view.setTranslationY(offset);
ObjectAnimator slideIn = ObjectAnimator.ofFloat(view, TRANSLATION_Y, 0);
slideIn.setDuration(SLIDE_IN_DURATION);
slideIn.setInterpolator(new OvershootInterpolator(0.8f));
return slideIn;
}
use of android.view.animation.OvershootInterpolator in project muzei by romannurik.
the class MuzeiActivity method updateUiMode.
private void updateUiMode() {
// TODO: this should really just use fragment transactions and transitions
int newUiMode = UI_MODE_INTRO;
if (mWallpaperActive) {
newUiMode = UI_MODE_TUTORIAL;
if (mSeenTutorial) {
newUiMode = UI_MODE_ART_DETAIL;
}
}
if (mUiMode == newUiMode) {
return;
}
// Crossfade between main containers
final View oldContainerView = getMainContainerForUiMode(mUiMode);
final View newContainerView = getMainContainerForUiMode(newUiMode);
if (oldContainerView != null) {
oldContainerView.animate().alpha(0).setDuration(1000).withEndAction(new Runnable() {
@Override
public void run() {
oldContainerView.setVisibility(View.GONE);
}
});
}
if (newContainerView != null) {
if (newContainerView.getAlpha() == 1) {
newContainerView.setAlpha(0);
}
newContainerView.setVisibility(View.VISIBLE);
newContainerView.animate().alpha(1).setDuration(1000).withEndAction(null);
}
// Special work
if (newUiMode == UI_MODE_INTRO) {
FirebaseAnalytics.getInstance(this).logEvent(FirebaseAnalytics.Event.TUTORIAL_BEGIN, null);
final View activateButton = findViewById(R.id.activate_muzei_button);
activateButton.setAlpha(0);
final AnimatedMuzeiLogoFragment logoFragment = (AnimatedMuzeiLogoFragment) getFragmentManager().findFragmentById(R.id.animated_logo_fragment);
logoFragment.reset();
logoFragment.setOnFillStartedCallback(new Runnable() {
@Override
public void run() {
activateButton.animate().alpha(1f).setDuration(500);
}
});
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
logoFragment.start();
}
}, 1000);
}
if (mUiMode == UI_MODE_INTRO || newUiMode == UI_MODE_INTRO) {
FragmentManager fm = getSupportFragmentManager();
Fragment demoFragment = fm.findFragmentById(R.id.demo_view_container);
if (newUiMode == UI_MODE_INTRO && demoFragment == null) {
fm.beginTransaction().add(R.id.demo_view_container, MuzeiRendererFragment.createInstance(true, true)).commit();
} else if (newUiMode != UI_MODE_INTRO && demoFragment != null) {
fm.beginTransaction().remove(demoFragment).commit();
}
}
if (newUiMode == UI_MODE_TUTORIAL) {
float animateDistance = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 100, getResources().getDisplayMetrics());
View mainTextView = findViewById(R.id.tutorial_main_text);
mainTextView.setAlpha(0);
mainTextView.setTranslationY(-animateDistance / 5);
View subTextView = findViewById(R.id.tutorial_sub_text);
subTextView.setAlpha(0);
subTextView.setTranslationY(-animateDistance / 5);
final View affordanceView = findViewById(R.id.tutorial_icon_affordance);
affordanceView.setAlpha(0);
affordanceView.setTranslationY(animateDistance);
View iconTextView = findViewById(R.id.tutorial_icon_text);
iconTextView.setAlpha(0);
iconTextView.setTranslationY(animateDistance);
AnimatorSet set = new AnimatorSet();
set.setStartDelay(500);
set.setDuration(250);
set.playTogether(ObjectAnimator.ofFloat(mainTextView, View.ALPHA, 1f), ObjectAnimator.ofFloat(subTextView, View.ALPHA, 1f));
set.start();
set = new AnimatorSet();
set.setStartDelay(2000);
// Bug in older versions where set.setInterpolator didn't work
Interpolator interpolator = new OvershootInterpolator();
ObjectAnimator a1 = ObjectAnimator.ofFloat(affordanceView, View.TRANSLATION_Y, 0);
ObjectAnimator a2 = ObjectAnimator.ofFloat(iconTextView, View.TRANSLATION_Y, 0);
ObjectAnimator a3 = ObjectAnimator.ofFloat(mainTextView, View.TRANSLATION_Y, 0);
ObjectAnimator a4 = ObjectAnimator.ofFloat(subTextView, View.TRANSLATION_Y, 0);
a1.setInterpolator(interpolator);
a2.setInterpolator(interpolator);
a3.setInterpolator(interpolator);
a4.setInterpolator(interpolator);
set.setDuration(500).playTogether(ObjectAnimator.ofFloat(affordanceView, View.ALPHA, 1f), ObjectAnimator.ofFloat(iconTextView, View.ALPHA, 1f), a1, a2, a3, a4);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
set.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
ImageView emanateView = (ImageView) findViewById(R.id.tutorial_icon_emanate);
AnimatedVectorDrawable avd = (AnimatedVectorDrawable) getResources().getDrawable(R.drawable.avd_tutorial_icon_emanate, getTheme());
emanateView.setImageDrawable(avd);
avd.start();
}
});
}
set.start();
}
if (newUiMode == UI_MODE_ART_DETAIL) {
FirebaseAnalytics.getInstance(this).logEvent(FirebaseAnalytics.Event.TUTORIAL_COMPLETE, null);
}
mPanScaleProxyView.setVisibility(newUiMode == UI_MODE_ART_DETAIL ? View.VISIBLE : View.GONE);
mUiMode = newUiMode;
maybeUpdateArtDetailOpenedClosed();
}
use of android.view.animation.OvershootInterpolator in project muzei by romannurik.
the class AnimatedMuzeiLogoFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.animated_logo_fragment, container, false);
mSubtitleView = rootView.findViewById(R.id.logo_subtitle);
mLogoView = (AnimatedMuzeiLogoView) rootView.findViewById(R.id.animated_logo);
mLogoView.setOnStateChangeListener(new AnimatedMuzeiLogoView.OnStateChangeListener() {
@Override
public void onStateChange(int state) {
if (state == AnimatedMuzeiLogoView.STATE_FILL_STARTED) {
mSubtitleView.setAlpha(0);
mSubtitleView.setVisibility(View.VISIBLE);
mSubtitleView.setTranslationY(-mSubtitleView.getHeight());
// Bug in older versions where set.setInterpolator didn't work
AnimatorSet set = new AnimatorSet();
Interpolator interpolator = new OvershootInterpolator();
ObjectAnimator a1 = ObjectAnimator.ofFloat(mLogoView, View.TRANSLATION_Y, 0);
ObjectAnimator a2 = ObjectAnimator.ofFloat(mSubtitleView, View.TRANSLATION_Y, 0);
ObjectAnimator a3 = ObjectAnimator.ofFloat(mSubtitleView, View.ALPHA, 1);
a1.setInterpolator(interpolator);
a2.setInterpolator(interpolator);
set.setDuration(500).playTogether(a1, a2, a3);
set.start();
if (mOnFillStartedCallback != null) {
mOnFillStartedCallback.run();
}
}
}
});
reset();
return rootView;
}
use of android.view.animation.OvershootInterpolator in project smartmodule by carozhu.
the class FloatingActionMenu method init.
private void init() {
mOvershootInterpolator = new OvershootInterpolator();
mAccelerateInterpolator = new AccelerateInterpolator();
initCover();
}
use of android.view.animation.OvershootInterpolator in project Tapad by berict.
the class AnimateHelper method scaleInOverShoot.
public void scaleInOverShoot(final View view, final int delay, final long duration, String handlerName) {
final ScaleAnimation scaleInOverShoot = new ScaleAnimation(0, 1, 0, 1, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
view.setVisibility(View.INVISIBLE);
scaleInOverShoot.setInterpolator(new OvershootInterpolator());
Map<String, Handler> handlerCreator = new HashMap<>();
handlerCreator.put(handlerName, new Handler());
handlerCreator.get(handlerName).postDelayed(new Runnable() {
@Override
public void run() {
scaleInOverShoot.setDuration(duration);
view.startAnimation(scaleInOverShoot);
view.setVisibility(View.VISIBLE);
Log.i("AnimateHelper", "scale IN OVERSHOOT effect for " + String.valueOf(duration) + "ms with " + String.valueOf(delay) + "ms delay");
}
}, delay);
}
Aggregations