如何在CAKeyframeAnimation中使用转换

时间:2016-06-22 04:05:49

标签: objective-c caanimation

我想使用CAKeyframeAnimation显示一些图片,如何在图片之间执行transitions?或者我如何将CATransition添加到animation?例如:image1缓和然后image2缓和,image2淡出然后image3淡入等等

2 个答案:

答案 0 :(得分:2)

CAKeyframeAnimation:

06-22 10:56:50.798 E/mono-rt (15470): java.lang.IllegalArgumentException: Binary XML file line #1: Duplicate id 0x7f0a0099, tag null, or parent id 0x7f0a007b with another fragment for com.google.android.gms.maps.MapFragment
06-22 10:56:50.798 E/mono-rt (15470):   at android.app.FragmentManagerImpl.onCreateView(FragmentManager.java:2136)
06-22 10:56:50.798 E/mono-rt (15470):   at android.app.Activity.onCreateView(Activity.java:5516)
06-22 10:56:50.798 E/mono-rt (15470):   at android.support.v4.app.BaseFragmentActivityHoneycomb.onCreateView(BaseFragmentActivityHoneycomb.java:34)
06-22 10:56:50.798 E/mono-rt (15470):   at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:78)
06-22 10:56:50.798 E/mono-rt (15470):   at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:733)
06-22 10:56:50.798 E/mono-rt (15470):   at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
06-22 10:56:50.798 E/mono-rt (15470):   at android.view.LayoutInflater.rInflate(LayoutInflater.java:809)
06-22 10:56:50.798 E/mono-rt (15470):   at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
06-22 10:56:50.798 E/mono-rt (15470):   at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
06-22 10:56:50.798 E/mono-rt (15470):   at md5ec4b17f0066095dde498afe2bdaa8cb9.PeopleCheckinFragment.n_onCreateView(Native Method)
06-22 10:56:50.798 E/mono-rt (15470):   at md5ec4b17f0066095dde498afe2bdaa8cb9.PeopleCheckinFragment.onCreateView(PeopleCheckinFragment.java:39)
06-22 10:56:50.798 E/mono-rt (15470):   at android.support.v4.app.Fragment.performCreateView(Fragment.java:1962)
06-22 10:56:50.798 E/mono-rt (15470):   at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1026)
06-22 10:56:50.798 E/mono-rt (15470):   at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1207)
06-22 10:56:50.798 E/mono-rt (15470):   at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:738)
06-22 10:56:50.798 E/mono-rt (15470):   at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1572)
06-22 10:56:50.798 E/mono-rt (15470):   at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:493)
06-22 10:56:50.798 E/mono-rt (15470):   at android.os.Handler.handleCallback(Handler.java:739)
06-22 10:56:50.798 E/mono-rt (15470):   at android.os.Handler.dispatchMessage(Handler.java:95)
06-22 10:56:50.798 E/mono-rt (15470):   at android.os.Looper.loop(Looper.java:135)
06-22 10:56:50.798 E/mono-rt (15470):   at android.app.ActivityThread.main(ActivityThread.java:5930)
06-22 10:56:50.798 E/mono-rt (15470):   at java.lang.reflect.Method.invoke(Native Method)
06-22 10:56:50.798 E/mono-rt (15470):   at java.lang.reflect.Method.invoke(Method.java:372)
06-22 10:56:50.798 E/mono-rt (15470):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1405)
06-22 10:56:50.798 E/mono-rt (15470):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1200)

答案 1 :(得分:0)

一个图像的一层效果很好。我可以在每个图层的开头/结尾添加动画,以显示进/出过渡。