Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scale & Translate animation

I require an animation for an image in my application. The image should start coming from the top left corner till the middle of screen. The image size will be smaller at the initial stage. While coming to the middle of the screen, its size should increase(i.e. scaling should take place). Image should not go back to its original position. It should be placed at the middle of the screen itself after the animation.

Can anyone please help.

like image 856
Anju Avatar asked Nov 11 '10 06:11

Anju


People also ask

What do they mean by scale?

(Entry 1 of 7) 1 : an instrument or machine for weighing. 2a : a beam that is supported freely in the center and has two pans of equal weight suspended from its ends —usually used in plural. b : either pan or tray of a balance. scale.

What is scale AI do?

Scale AI is the data platform for AI, providing high quality training data for leading machine learning teams.

What is the meaning of scale in geography?

Map scale refers to the relationship (or ratio) between distance on a map and the corresponding distance on the ground. For example, on a 1:100000 scale map, 1cm on the map equals 1km on the ground.


1 Answers

Please find the answer here. Create an xml inside /res/anim folder and put the below code into it.

<?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:fromXScale="0.0" android:fromYScale="0.0"           android:toXScale="1.0" android:toYScale="1.0"            android:duration="700" android:fillBefore="false" />    <translate android:fromXDelta="-200" android:fromYDelta="-200"           android:duration="700" /> </set> 

Place the below code inside the java file:

Animation logoMoveAnimation = AnimationUtils.loadAnimation(this, R.anim.logoanimation);  logoIV.startAnimation(logoMoveAnimation); 

logoanimation is the name of my animation xml file.

Thanks for all those who tried out for my question.

like image 65
Anju Avatar answered Sep 26 '22 14:09

Anju