2015-08-23 29 views

risposta

4

parte @Behnam Eskandari risposta, è anche possibile utilizzare l'animazione Sprite. È piccolo e molto veloce e non occupa molto spazio sul telefono. È facile da implementare anche tu, devi solo creare il tuo foglio sprite. Puoi vedere lo examples here.

Per ottenere ciò su Android, è possibile utilizzare this library. Tuttavia ha alcune limitazioni, ma funziona bene.

Ecco il codice come l'ho usato.

Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.runningcat); 
int width = bitmap.getWidth(); 
int height = bitmap.getHeight(); 

int frameWidth = width/5; //you have 5 columns 
int frameHeight = height/5; //and 5 rows 
int frameNum = 25;    //there would be 25 images 


SpriteSheetDrawer spriteSheetDrawer = new SpriteSheetDrawer(
     bitmap, 
     frameWidth, 
     frameHeight, 
     frameNum) 
     .spriteLoop(true) 
     .frequency(2); //change it as per your need 


DisplayObject displayObject = new DisplayObject(); 
displayObject 
     .with(spriteSheetDrawer) 
     .tween() 
     .tweenLoop(true) 
     .transform(0, 0) //I have changed it according to my need, you can also do this by changing these values 
     .toX(4000, 0) //this one too. 
     .end(); 
//In actual example, it's set as animation starts from one end of the screen and goes till the other one. 


FPSTextureView textureView = (FPSTextureView) findViewById(R.id.fpsAnimation); 
textureView.addChild(displayObject).tickStart(); 

Spero che sia d'aiuto.

17

È possibile utilizzare SVG per animare un testo o di un logo o di altra cosa è che ha creato in SVG

vedono questo: AnimatedSvgView

7

È possibile eseguire l'animazione del file After Effects dal designer e utilizzando la libreria Lottie di Airbnb, è possibile renderizzarlo sull'app Android.

È una libreria open source con grandi funzionalità, spero che risolva il tuo problema.

consultare qui per Lottie lib: - https://github.com/airbnb/lottie-android

E 'il modo migliore e facile da eseguire la varietà di animazioni su Android.

È inoltre possibile utilizzare la soluzione fornita da @Behnam Eskandari ma l'unico problema è che il supporto è solo per immagini SVG.