for (int i = 0; i < inData.Albums.Count; i++ )
{
IAlbumData albumData = inData.Albums[i];
Album newAlbum = new Album();
m_AlbumList.Add(newAlbum);
Canvas.SetLeft(newAlbum, 20 + 30 * i);
this.LayoutRoot.Children.Add(newAlbum);
newAlbum.Click += new RoutedEventHandler(newAlbum_Click);
TranslateTransform translate = new TranslateTransform();
newAlbum.RenderTransform = translate;
Storyboard sb = new Storyboard();
DoubleAnimation moveAnimation = new DoubleAnimation();
moveAnimation.From = 0;
moveAnimation.To = 20 + 50 * i;
Duration dur = TimeSpan.FromSeconds(0.5);
moveAnimation.Duration = dur;
Storyboard.SetTarget(moveAnimation, translate);
Storyboard.SetTargetProperty(moveAnimation, new PropertyPath(TranslateTransform.XProperty));
sb.Children.Add(moveAnimation);
sb.Begin();
}
2009年2月27日
Silverlight Storyboard Animation
有時候我必須透過程式直接產生物件,並加入動畫的效果,例如由網路讀取使用者的相簿數量,然後在相簿出現的時後,產生移動或淡出的特效。下面的程式碼可以幫助學會 Storyboard 的使用,其中,特別要注意的就是 PropertyPath 的建立。
訂閱:
張貼留言 (Atom)
Deploying Vue & .NET with Google OAuth on GCP Cloud Run
Deploying Vue & .NET with Google OAuth on GCP Cloud Run Deploying Vue & .NET with Google OAuth on GCP Cloud Run...
- 
有幾個正正當當的 SEO 規則: 讓 Google 與 Yahoo 知道這個網站或網頁的存在:Google 可以透過網站管理工具,Yahoo 則透過 siteexplorer。 找出與網站相關的熱門關鍵字:既然想透過 Google 或 Yahoo 的關鍵字搜尋,當然不要選...
- 
使用 WPF 建立雙螢幕或多螢幕畫面,作法如下: 首先刪除 App.xaml 中的 StartupUri="MainWindows.xaml"的設定。 加入 System.Windows.Forms (for Screen) 與 System.Drawi...
- 
自從我知道了 iPhone 的 App Store 平台服務後,才發現 Google 與 Microsoft 也有類似的服務。 Apple - App Store Google - Android Market Microsoft - Windows Mobile Market...
 
沒有留言:
張貼留言