我使用了一些WPF雙動畫來移動StackPanel
。WPF動畫係數
<Canvas ClipToBounds="True" Name="canMain" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" >
<StackPanel Name="tbmarquee" HorizontalAlignment="Stretch" ></StackPanel>
</Canvas>
我用同樣的時間爲30秒,我把不同量的UIElemnts
StackPanel
下每次。所以StackPanel
的寬度是不同的,它會改變動畫的速度,就像我在StackPanel
下有很多物品一樣,那麼動畫非常緩慢,如果我有1個物品,它的速度非常快。
任何線索係數我必須用才能獲得穩定的動畫速度?
謝謝!
P.S.
看來,這個代碼給出了或多或少的修正係數
var coeff = 0;
if (test.Count >= 1 && test.Count <= 10)
coeff = 60;
else if (test.Count > 10 && test.Count <= 20)
coeff = 120;
else if (test.Count > 20 && test.Count <= 30)
coeff = 240;
else if (test.Count > 30 && test.Count <= 40)
coeff = 300;
else if (test.Count > 40 && test.Count <= 50)
coeff = 350;
else if (test.Count > 50 && test.Count <= 60)
coeff = 400;
else if (test.Count > 60 && test.Count <= 70)
coeff = 450;
else if (test.Count > 70 && test.Count <= 80)
coeff = 500;
else if (test.Count > 80 && test.Count <= 90)
coeff = 530;
else if (test.Count > 90 && test.Count <= 100)
coeff = 560;
and etc...
任何線索如何將它轉換成一些表達?
它可能是一個想法改變DesiredFrameRate? (http://msdn.microsoft.com/en-us/library/system.windows.media.animation.timeline.desiredframerate.aspx) – Klaus78