2013-07-31 24 views
3

我需要一個規模驅動的動畫對話框。我想與反彈的效果做到這一點我試圖反彈插入器如何編輯android動畫插值器?

<scale xmlns:android="http://schemas.android.com/apk/res/android" 
    android:duration="500" 
    android:fromXScale="0" 
    android:fromYScale="0" 
    android:interpolator="@android:anim/bounce_interpolator" 
    android:toXScale="1" 
    android:toYScale="1" /> 

我要修改的反彈效應,使其更慢/更快,尺寸反彈至。我沒有發現任何東西, 牛逼試圖用套

<set > 
    <scale 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:duration="500" 
     android:fromXScale="0" 
     android:fromYScale="0" 
     android:toXScale="1" 
     android:toYScale="1" /> 
    <scale 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:duration="100" 
     android:fromXScale="1" 
     android:fromYScale="1" 
     android:startOffset="500" 
     android:toXScale=".8" 
     android:toYScale=".8" /> 
    <scale 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:duration="100" 
     android:fromXScale=".8" 
     android:fromYScale=".8" 
     android:startOffset="600" 
     android:toXScale="1" 
     android:toYScale="1" /> 
</set> 

整個動畫的行爲很奇怪,使其? 所以我的問題是如何通過設置來修復這個動畫或者如何修改bounce_interpolator?

回答

2

使用ipfx.org創建自定義插補器。
以反彈示例並根據需要進行編輯。
http://ipfx.org/?p=7ffffffe575efffe9e02fffed8f6fffe&l=2f13c5ac138b3d6ad338a5a77a8386807d6e

不是用在您的應用程序()

import org.ipfx.Interpolator; 

... 
... 

final org.ipfx.Interpolator interpolator = org.ipfx.Interpolator.parseUrl(urlData); 

ObjectAnimator animator = ObjectAnimator.ofFloat(...); 
animator.setDuration(1000); 

animator.setInterpolator(new TimeInterpolator() { 
    @Override 
    public float getInterpolation(float input) { 
     return interpolator.calc(input); 
    } 
}); 

animator.start(); 
創建插值