How do they do this? animated drawer rotation possible?
In the screenshots below, touching the 'Touch' circle at the bottom causes that circle to rotate around itself, and then 4 new navigation buttons come out that take me to other screens/activities in the app. I really want to have this in my app..
Is it a sliding drawer or some other strategy? BTW I am targeting android version 2.1
It looks as if it's mainly a animation that rotates an image. Once the animation has finished, the buttons are activated.
ImageView discsAndButtons = (ImageView) findViewById(R.id.discsAndButtons);
Animation anim = new RotateAnimation(0.0f, 90.0f, 0.0f, 480.0f);
anim.setDuration(600);
anim.setFillAfter(true);
anim.setAnimationListener(this);
discsAndButtons.setAnimation(anim);
...
void onAnimationEnd(Animation animation) {
ViewGroup buttonLayer = (ViewGroup) findViewById(R.id.buttonLayer);
buttonLayer.setVisibility(View.VISIBLE);
}
Visually, the buttons are part of the image. But the effective buttons are probably on a separate layer above the image and only made visible after the animation has finished (except for the TOUCH button).
Related
I'm implementing animation for images in my android app. Want to disable touch or moving image with fingers by users. User can navigate to next image by clicking next/previous buttons.
Kindly help me how I can disable touch or moving image manually by users programmatically.
Thanks in advance.
EDIT:
animation = new TranslateAnimation(0.0f, -(vWidth-aWidth),0.0f, 0.0f);
animation.setDuration(7000);
animation.setRepeatCount(1);
animation.setRepeatMode(2);
animation.setFillAfter(true);
fullImageView.startAnimation(animation);
Here, vWidth is double the aWidth.
This will animate image on screen. User can see this animation but they should not drag the image to see full width.
Please check and help me.
In my layout, I am having a set of tiles(Something similar to windows phone home screen) .I am trying to flip the tile to show more content. I have taken a look at card flipping, but then it flips the entire fragment.I want it to flip a part of the whole layout.I have tried rotating it using Object animator .Here is my code..
View v = findViewById(R.id.iotd_relative);
ObjectAnimator animation = ObjectAnimator.ofFloat(v, "rotationY", 0.0f, 360f);
animation.setDuration(3600);
animation.setRepeatCount(ObjectAnimator.INFINITE);
animation.setInterpolator(new AccelerateDecelerateInterpolator());
animation.start();
Is there any possibility of calling another layout when it flips?
I would recommend using a ScaleAnimation, heres a good example that simulates a Card Flip, you should be able to get what you want from there.
Use Android's scale animation to simulate a 3D flip...
working in android last couple of days and i am trying to rotate an arrow by pressing a button. Using RotateAnimation and:
setFillAfter(true);
arrow remains in last position as supposed to.
But when i press button again arrow yes starts to rotate from initial position, but there is also the "previous" arrow from the last call of animation which is finally overlapped by "new" arrow. So i guess i need to somehow reset/clear the setFillAfter but i can't find a way.
My code goes like this:
//Animation start
float Xaxis=0.835366f;
float Yaxis=0.676692f;
RotateAnimation rotateAnimation1 = new RotateAnimation(0, 180,
Animation.RELATIVE_TO_SELF, Xaxis,Animation.RELATIVE_TO_SELF, Yaxis);
rotateAnimation1.setInterpolator(new LinearInterpolator());
rotateAnimation1.setDuration(2500);
rotateAnimation1.setRepeatCount(0);
image.startAnimation(rotateAnimation1);
rotateAnimation1.setAnimationListener(this);
#Override
public void onAnimationEnd(Animation animation) {
animation.setFillAfter(true);
}
Any ideas would be usefull..
I have tried invalidate, clearAnimation to image, setting fillafter to false, reset on animation but still same.
It is fixed, emulator is configured with shared GPU and runs perfectly. Fast and without any remainings of previous animations.
Alphaing a drawable work well like this:
if(mAlphaAnimation == null){
mAlphaAnimation = ObjectAnimator.ofFloat(this, "alpha", 0.0f,1.0f).setDuration(TARGET_ANIM_ALPHA_DURATION);
mAlphaAnimation.setInterpolator(new AccelerateDecelerateInterpolator());
mAlphaAnimation.setStartDelay(TARGET_ANIM_ALPHA_DELAY_BASE*power);
mAlphaAnimation.setRepeatCount(ValueAnimator.INFINITE);
mAlphaAnimation.setRepeatMode(ValueAnimator.REVERSE);
mAlphaAnimation.addUpdateListener(this);
}
But if I want rotate a drawable like below , it don's work.
private void createRotateAnim(float fromDegress,float toDegress,int duration){
if(mRotateAnimation == null){
mRotateAnimation = ObjectAnimator.ofFloat(this, "rotation",fromDegress,toDegress).setDuration(duration);
mRotateAnimation.setStartDelay(100);
mRotateAnimation.setInterpolator(new AccelerateInterpolator());
mRotateAnimation.addUpdateListener(this);
}
}
Anyone can help me to fix this issue, or these is any other way to create a rotation drawable animation .
I am sorry to my poor English.
Try with ObjectAnimator instead.
ImageView imageview = (ImageView)findViewById(R.id.image);
ObjectAnimator imageViewObjectAnimator = ObjectAnimator.ofFloat(imageview ,
"rotation", 0f, 360f);
imageViewObjectAnimator.setDuration(1000); // miliseconds
imageViewObjectAnimator.start();
EDIT
Since this question draw some attention let me to explain why to use ObjectAnimator instead of other Transition animators
The thing about using ObjectAnimator is that it's moving both the visible and the clickable area of the item, if you use another animation method, for example Transition Animation or some other Animators, and let's say if you want to move the Button from the bottom left of the screen to the top left, it will only move the visible area but not the Button itself, the clickable area will still be on the previous position, in this case the clickable area will still be on the bottom left instead of the top left where you moved the button.
If you do the same with ObjectAnimator, both the visible area, and the clickable area will move the the desired location.
Try this simple Rotation Animation applied to a image.
ImageView imageview = (ImageView)findViewById(R.id.myimage);
RotateAnimation rotate = new RotateAnimation(180, 360, Animation.RELATIVE_TO_SELF,
0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
rotate.setDuration(500);
imageview.startAnimation(rotate);
This answer is just for a sake of question, it is correct that Clickable area will be different than View's current position. Please check this question for making clickable area correct. Button is not clickable after TranslateAnimation
I'm trying to do an animation that takes a button (with a custom background image and system text) and fades it out. That works fine, actually. The issue is after the animation it goes back to it's initial state. I want it to animate and stay that way.
Thanks!
AlphaAnimation anim = new AlphaAnimation(1, 0.2f);
anim.setDuration (5000);
textView.startAnimation (anim);
anim.setFillAfter(true);
That should work.
My answer is 'stolen' form android.View transparency