Search code examples
javaandroidanimationreferencesplash-screen

Android Animation : Is there some reference website for Android animation effect, how can I create this logo animation?


Here is the animation:

https://www.youtube.com/watch?v=YqFI4r4VYgg&feature=youtu.be

Right now I am doing this

<ImageView
    android:id="@+id/zweet_logo"
    android:layout_width="200dp"
    android:layout_height="200dp"
    android:layout_centerHorizontal="true"
    android:layout_centerVertical="true"
    android:contentDescription="@string/description"
    android:src="@drawable/zweet_logo" />

<RelativeLayout
    android:id="@+id/appLoading"
    style="@style/GenericProgressBackgroundAppLoading"
    android:layout_width="33dp"
    android:layout_height="33dp"
    android:layout_below="@+id/zweet_logo"
    android:layout_centerHorizontal="true" >

    <ProgressBar style="@style/GenericProgressIndicatorAppLoading" />
</RelativeLayout>

logo_animation.xml

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/linear_interpolator" >

<scale
    android:duration="700"
    android:fillBefore="false"
    android:fromXScale="0.0"
    android:fromYScale="0.0"
    android:toXScale="1.0"
    android:toYScale="1.0" />

<translate
    android:duration="700"
    android:fromXDelta="-200"
    android:fromYDelta="-200" />

MainActivity is like

    /** Define and start logo animation */
    Animation logoMoveAnimation = AnimationUtils.loadAnimation(this,
            R.anim.logo_animation);
    ImageView zweetLogo = (ImageView) findViewById(R.id.zweet_logo);
    zweetLogo.startAnimation(logoMoveAnimation);

That's so basic.

--

Right I have the iOS code:

- (void)animateZweetLogo
{
CGRect startFrame = self.zweetLogoImageView.frame;

MTTimingFunction timingFuction  = kMTEaseOutBounce;
CGFloat duration       = kAnimateZweetLogoAnimationDuration;
CGFloat endY           = startFrame.origin.y;
CGFloat endX           = startFrame.origin.x;
CGFloat endScale       = 1;
CGFloat endRotation    = 0;
CGFloat endAlpha       = 1;

[UIView mt_animateViews:@[self.zweetLogoImageView]
               duration:duration
         timingFunction:timingFuction
                options:MTViewAnimationOptionBeginFromCurrentState
             animations:^{
                 //self.zweetLogoImageView.mt_animationPerspective = -1.0 / 500.0;

                 CGRect r        = self.zweetLogoImageView.frame;
                 r.origin.x      = endX;
                 r.origin.y      = endY;

                 // scale
                 CGFloat h       = startFrame.size.height;
                 CGFloat w       = startFrame.size.width;
                 CGFloat hh      = h * endScale;
                 CGFloat ww      = w * endScale;
                 r.size.height   = hh;
                 r.size.width    = ww;
                 r.origin.y      -= (hh - h) / 2.0;
                 r.origin.x      -= (ww - w) / 2.0;
                 self.zweetLogoImageView.frame= r;

                 // alpha
                 self.zweetLogoImageView.alpha = endAlpha;

                 // rotation
                 CGFloat radians = mt_degreesToRadians(endRotation);
                 self.zweetLogoImageView.layer.transform = CATransform3DMakeRotation(radians, 0, 1, 0);

             } completion:^{
                 [self performSelectorOnMainThread:@selector(resumeLoading) withObject:nil waitUntilDone:YES];
             }];
}

Is there some library of animations that I can use to do something that look like the iOS code? Or there is no other than just code and test it in Java in a long and iterative process?


Solution

  • Check http://www.mybringback.com or http://thenewboston.org/list.php?cat=6. or developer docs at developer.android.com are pretty useful.