我看到了一個由設計人員爲移動應用程序設計的鏈接。我想實現this kind of effect or animation我不知道該說些什麼。如何在Android中創建Motion Splash Screen?
請指導我如何在android應用程序啓動畫面中實現完全相同的效果。
我需要gif圖像和顯示在web視圖中嗎?
或任何類型的可繪製動畫?
任何類型的建議和幫助將是可觀的。
在此先感謝。
我看到了一個由設計人員爲移動應用程序設計的鏈接。我想實現this kind of effect or animation我不知道該說些什麼。如何在Android中創建Motion Splash Screen?
請指導我如何在android應用程序啓動畫面中實現完全相同的效果。
我需要gif圖像和顯示在web視圖中嗎?
或任何類型的可繪製動畫?
任何類型的建議和幫助將是可觀的。
在此先感謝。
您可以使用AnimatorSet
該類扮演了一組指定的順序動畫的對象。 動畫可以設置爲一起播放,按順序播放或在指定延遲後播放。
有兩種不同的方法來添加動畫到 AnimatorSet:要麼playTogether()或playSequentially()方法 可以被稱爲一次全部添加一組動畫,或 播放(動畫)可與Builder 類中的方法一起使用以逐個添加動畫。
可以在它的動畫之間設置一個循環依賴關係爲 的AnimatorSet。例如,可以將動畫a1設置爲 以在動畫a2之前開始,在a3之前開始a2,在a1之前以a3開始。該配置的 結果未定義,但通常會導致 不受任何正在播放的受影響的動畫的影響。由於這個原因(因爲循環依賴關係無論如何都沒有邏輯意義),所以應該避免循環依賴關係,並且動畫的依賴關係流應該只在一個方向上。
您可以查看以下鏈接DEMP情況
什麼是必須要做的是,在圖像上您所提供的所有這些都只是單一的圖像在一定的超時時間之後,它們將從一個轉換到另一個。
您需要爲每個過渡幀添加大量圖像,然後相應地移動它們。
它有點像在Android上創建啓動動畫。 每幅圖像將代表整個動畫的單個幀。
ImageView demoImage = (ImageView) findViewById(R.id.DemoImage);
int imagesToShow[] = { R.drawable.image1, R.drawable.image2,R.drawable.image3 };
animate(demoImage, imagesToShow, 0,false);
private void animate(final ImageView imageView, final int images[], final int imageIndex, final boolean forever) {
//imageView <-- The View which displays the images
//images[] <-- Holds R references to the images to display
//imageIndex <-- index of the first image to show in images[]
//forever <-- If equals true then after the last image it starts all over again with the first image resulting in an infinite loop. You have been warned.
int fadeInDuration = 500; // Configure time values here
int timeBetween = 3000;
int fadeOutDuration = 1000;
imageView.setVisibility(View.INVISIBLE); //Visible or invisible by default - this will apply when the animation ends
imageView.setImageResource(images[imageIndex]);
Animation fadeIn = new AlphaAnimation(0, 1);
fadeIn.setInterpolator(new DecelerateInterpolator()); // add this
fadeIn.setDuration(fadeInDuration);
Animation fadeOut = new AlphaAnimation(1, 0);
fadeOut.setInterpolator(new AccelerateInterpolator()); // and this
fadeOut.setStartOffset(fadeInDuration + timeBetween);
fadeOut.setDuration(fadeOutDuration);
AnimationSet animation = new AnimationSet(false); // change to false
animation.addAnimation(fadeIn);
animation.addAnimation(fadeOut);
animation.setRepeatCount(1);
imageView.setAnimation(animation);
animation.setAnimationListener(new AnimationListener() {
public void onAnimationEnd(Animation animation) {
if (images.length - 1 > imageIndex) {
animate(imageView, images, imageIndex + 1,forever); //Calls itself until it gets to the end of the array
}
else {
if (forever == true){
animate(imageView, images, 0,forever); //Calls itself to start the animation all over again in a loop if forever = true
}
}
}
public void onAnimationRepeat(Animation animation) {
// TODO Auto-generated method stub
}
public void onAnimationStart(Animation animation) {
// TODO Auto-generated method stub
}
});
}
鏈接是*從來沒有[一個好答案](http://stackoverflow.com/help/how-to-answer)。請解釋*爲什麼*您認爲這可能有助於解決所述問題。如果你不確定,那麼這可能不應該是一個答案,而是一個評論。 –
好的,今晚我會做,因爲我目前有點忙。 @MH。 – sayan
@MH。現在看..也許刪除downer? – sayan