private void UpdateNextItem() { var sb = new Windows.UI.Xaml.Media.Animation.Storyboard(); if (_translate != null) { var anim = new Windows.UI.Xaml.Media.Animation.DoubleAnimation(); anim.Duration = new Duration(TimeSpan.FromMilliseconds(500)); anim.From = 0; if (Direction == LiveTile.SlideDirection.Up) { anim.To = -this.ActualHeight; } else if (Direction == LiveTile.SlideDirection.Left) { anim.To = -this.ActualWidth; } anim.FillBehavior = Windows.UI.Xaml.Media.Animation.FillBehavior.HoldEnd; anim.EasingFunction = new Windows.UI.Xaml.Media.Animation.CubicEase() { EasingMode = Windows.UI.Xaml.Media.Animation.EasingMode.EaseOut }; Windows.UI.Xaml.Media.Animation.Storyboard.SetTarget(anim, _translate); if (Direction == LiveTile.SlideDirection.Up // || this.SlideDirection == SlideView.SlideDirection.Down ) { Windows.UI.Xaml.Media.Animation.Storyboard.SetTargetProperty(anim, "Y"); } else { Windows.UI.Xaml.Media.Animation.Storyboard.SetTargetProperty(anim, "X"); } sb.Children.Add(anim); } sb.Completed += (a, b) => { //Reset back and swap images, getting the next image ready if (_currentElement != null) { _currentElement.DataContext = GetCurrent(); } DispatcherTimer timer = new DispatcherTimer() { Interval = TimeSpan.FromMilliseconds(250) }; //Give the next panel a little time to load timer.Tick += (s, e) => { timer.Stop(); sb.Stop(); //Also resets transform if (_nextElement != null) { _nextElement.DataContext = GetNext(); } }; timer.Start(); }; sb.Begin(); }
private void mediaElement_Tapped(object sender, TappedRoutedEventArgs e) { MediaPlayerElement loc = sender as MediaPlayerElement; if (loc != null) { if (bMin == true) { Windows.UI.Xaml.Media.Animation.Storyboard lmax = loc.Resources["MyStoryboardMax"] as Windows.UI.Xaml.Media.Animation.Storyboard; if (lmax != null) { foreach (var a in lmax.Children) { Windows.UI.Xaml.Media.Animation.DoubleAnimation da = a as Windows.UI.Xaml.Media.Animation.DoubleAnimation; if (da != null) { double w = Window.Current.Bounds.Width; da.To = w / 320; } } lmax.Begin(); } } else { Windows.UI.Xaml.Media.Animation.Storyboard lmin = loc.Resources["MyStoryboardMin"] as Windows.UI.Xaml.Media.Animation.Storyboard; lmin.Begin(); } } bMin = !bMin; }
/// <summary> /// Populates the page with content passed during navigation. Any saved state is also /// provided when recreating a page from a prior session. /// </summary> /// <param name="navigationParameter">The parameter value passed to /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested. /// </param> /// <param name="pageState">A dictionary of state preserved by this page during an earlier /// session. This will be null the first time a page is visited.</param> protected async override void LoadState(Object navigationParameter, Dictionary <String, Object> pageState) { pageTitle.Text = "Articles tagged \"" + App.page_title + "\""; navParam = navigationParameter.ToString(); ViewCommentsButton.Visibility = Visibility.Collapsed; progressRing.Visibility = Visibility.Visible; Windows.UI.Xaml.Media.Animation.Storyboard sb = this.FindName("PopInStoryBoard") as Windows.UI.Xaml.Media.Animation.Storyboard; if (sb != null) { sb.Begin(); } // TODO: Assign a bindable group to this.DefaultViewModel["Group"] // TODO: Assign a collection of bindable items to this.DefaultViewModel["Items"] FeedDataSource feedDataSource = (FeedDataSource)App.Current.Resources["feedDataSource"]; if (feedDataSource != null) { await feedDataSource.GetFeedsAsync("tag", navigationParameter.ToString()); } RootObject feedData = FeedDataSource.GetFeed(); if (feedData != null) { this.DefaultViewModel["Feed"] = feedData; this.DefaultViewModel["Items"] = feedData.posts; } if (pageState == null) { // When this is a new page, select the first item automatically unless logical page // navigation is being used (see the logical page navigation #region below.) if (!this.UsingLogicalPageNavigation() && this.itemsViewSource.View != null) { this.itemsViewSource.View.MoveCurrentToFirst(); } else { //this.itemsViewSource.View.MoveCurrentToPosition(-1); } } else { // Restore the previously saved state associated with this page if (pageState.ContainsKey("SelectedItem") && this.itemsViewSource.View != null) { // TODO: Invoke this.itemsViewSource.View.MoveCurrentTo() with the selected // item as specified by the value of pageState["SelectedItem"] string itemTitle = (string)pageState["SelectedItem"]; Post selectedItem = FeedDataSource.GetItem(itemTitle); this.itemsViewSource.View.MoveCurrentTo(selectedItem); } } ViewCommentsButton.Visibility = Visibility.Visible; progressRing.Visibility = Visibility.Collapsed; }
private void LoadStoryBoardSwitch() { _sbSortOFF = new Windows.UI.Xaml.Media.Animation.Storyboard(); _sbSortOFF.Children.Add(WinAppLibrary.Utilities.AnimationHelper.CreateScaleYAnimation(ScaleTransConsumableSort, 0, ANIMATION_SPEED)); _sbSortON = new Windows.UI.Xaml.Media.Animation.Storyboard(); _sbSortON.Children.Add(WinAppLibrary.Utilities.AnimationHelper.CreateScaleYAnimation(ScaleTransConsumableSort, 1, ANIMATION_SPEED)); }
private void LoadStoryBoardSwitch() { //ToGridView _sbDetailOFF = new Windows.UI.Xaml.Media.Animation.Storyboard(); _sbDetailOFF.Children.Add(WinAppLibrary.Utilities.AnimationHelper.CreateTranslateXAnimation(detailPanelTrans, Window.Current.Bounds.Width, ANIMATION_SPEED)); _sbDetailOFF.Begin(); _sbDetailON = new Windows.UI.Xaml.Media.Animation.Storyboard(); _sbDetailON.Children.Add(WinAppLibrary.Utilities.AnimationHelper.CreateScaleYAnimation(detailPanelScale, 1, 0)); _sbDetailON.Children.Add(WinAppLibrary.Utilities.AnimationHelper.CreateTranslateXAnimation(detailPanelTrans, 0, ANIMATION_SPEED)); }
private void Image_ImageOpened(object sender, RoutedEventArgs e) { Windows.UI.Xaml.Media.Animation.DoubleAnimation opacityanimation = new Windows.UI.Xaml.Media.Animation.DoubleAnimation(); opacityanimation.Duration = new TimeSpan(0, 0, 0, 0, 500); opacityanimation.From = 0; opacityanimation.To = 1; Windows.UI.Xaml.Media.Animation.Storyboard.SetTarget(opacityanimation, (DependencyObject)sender); Windows.UI.Xaml.Media.Animation.Storyboard.SetTargetProperty(opacityanimation, "Opacity"); Windows.UI.Xaml.Media.Animation.Storyboard storyboard = new Windows.UI.Xaml.Media.Animation.Storyboard(); storyboard.Children.Add(opacityanimation); storyboard.Begin(); }
public void InitializeComponent() { if (_contentLoaded) return; _contentLoaded = true; Application.LoadComponent(this, new System.Uri("ms-appx:///MapUtilities_Metro/Lower Level/Callouts/MapCallout.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Nested); storyboardAppearance = (Windows.UI.Xaml.Media.Animation.Storyboard)this.FindName("storyboardAppearance"); storyboardDisappearance = (Windows.UI.Xaml.Media.Animation.Storyboard)this.FindName("storyboardDisappearance"); myGrid = (Windows.UI.Xaml.Controls.Grid)this.FindName("myGrid"); gridScaleTransform = (Windows.UI.Xaml.Media.ScaleTransform)this.FindName("gridScaleTransform"); }
/// <summary> /// Populates the page with content passed during navigation. Any saved state is also /// provided when recreating a page from a prior session. /// </summary> /// <param name="navigationParameter">The parameter value passed to /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested. /// </param> /// <param name="pageState">A dictionary of state preserved by this page during an earlier /// session. This will be null the first time a page is visited.</param> protected override void LoadState(Object navigationParameter, Dictionary <String, Object> pageState) { // Run the PopInThemeAnimation Windows.UI.Xaml.Media.Animation.Storyboard sb = this.FindName("PopInStoryboard") as Windows.UI.Xaml.Media.Animation.Storyboard; if (sb != null) { sb.Begin(); } // TODO: Assign a bindable group to this.DefaultViewModel["Group"] // TODO: Assign a collection of bindable items to this.DefaultViewModel["Items"] string feedTitle = (string)navigationParameter; FeedData feedData = FeedDataSource.GetFeed(feedTitle); if (feedData != null) { this.DefaultViewModel["Feed"] = feedData; this.DefaultViewModel["Items"] = feedData.Items; } if (pageState == null) { // When this is a new page, select the first item automatically unless logical page // navigation is being used (see the logical page navigation #region below.) if (!this.UsingLogicalPageNavigation() && this.itemsViewSource.View != null) { this.itemsViewSource.View.MoveCurrentToFirst(); } else { this.itemsViewSource.View.MoveCurrentToPosition(-1); } } else { // Restore the previously saved state associated with this page if (pageState.ContainsKey("SelectedItem") && this.itemsViewSource.View != null) { // TODO: Invoke this.itemsViewSource.View.MoveCurrentTo() with the selected // item as specified by the value of pageState["SelectedItem"] string itemTitle = (string)pageState["SelectedItem"]; FeedItem selectedItem = FeedDataSource.GetItem(itemTitle); this.itemsViewSource.View.MoveCurrentTo(selectedItem); } } }
public void InitializeComponent() { if (_contentLoaded) return; _contentLoaded = true; Application.LoadComponent(this, new System.Uri("ms-appx:///Flip.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application); LayoutRoot = (Windows.UI.Xaml.Controls.Grid)this.FindName("LayoutRoot"); FlipAnimation = (Windows.UI.Xaml.Media.Animation.Storyboard)this.FindName("FlipAnimation"); BlockTop = (Windows.UI.Xaml.Controls.Border)this.FindName("BlockTop"); BlockBottom = (Windows.UI.Xaml.Controls.Border)this.FindName("BlockBottom"); BlockFlip = (Windows.UI.Xaml.Controls.Border)this.FindName("BlockFlip"); textBlockFlipTop = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("textBlockFlipTop"); textBlockFlipBottom = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("textBlockFlipBottom"); textBlockBottom = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("textBlockBottom"); textBlockTop = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("textBlockTop"); }
/// <summary> /// Populates the page with content passed during navigation. Any saved state is also /// provided when recreating a page from a prior session. /// </summary> /// <param name="navigationParameter">The parameter value passed to /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested. /// </param> /// <param name="pageState">A dictionary of state preserved by this page during an earlier /// session. This will be null the first time a page is visited.</param> protected override void LoadState(Object navigationParameter, Dictionary <String, Object> pageState) { // Run the PopInThemeAnimation Windows.UI.Xaml.Media.Animation.Storyboard sb = this.FindName("PopInStoryboard") as Windows.UI.Xaml.Media.Animation.Storyboard; if (sb != null) { sb.Begin(); } // Add this code to navigate the web view to the selected blog post. string itemTitle = (string)navigationParameter; FeedItem feedItem = FeedDataSource.GetItem(itemTitle); if (feedItem != null) { this.contentView.Navigate(feedItem.Link); this.DataContext = feedItem; } }
public void InitializeComponent() { if (_contentLoaded) return; _contentLoaded = true; Application.LoadComponent(this, new System.Uri("ms-appx:///DetailPage.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application); pageRoot = (NoelBlogReader.Common.LayoutAwarePage)this.FindName("pageRoot"); itemsViewSource = (Windows.UI.Xaml.Data.CollectionViewSource)this.FindName("itemsViewSource"); PopInStoryboard = (Windows.UI.Xaml.Media.Animation.Storyboard)this.FindName("PopInStoryboard"); contentViewBorder = (Windows.UI.Xaml.Controls.Border)this.FindName("contentViewBorder"); flipView = (Windows.UI.Xaml.Controls.FlipView)this.FindName("flipView"); contentView = (Windows.UI.Xaml.Controls.WebView)this.FindName("contentView"); backButton = (Windows.UI.Xaml.Controls.Button)this.FindName("backButton"); pageTitle = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("pageTitle"); FullScreenLandscape = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenLandscape"); Filled = (Windows.UI.Xaml.VisualState)this.FindName("Filled"); FullScreenPortrait = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenPortrait"); Snapped = (Windows.UI.Xaml.VisualState)this.FindName("Snapped"); }
public void InitializeComponent() { if (_contentLoaded) return; _contentLoaded = true; Application.LoadComponent(this, new System.Uri("ms-appx:///BlankPage.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application); LoginGridAppear = (Windows.UI.Xaml.Media.Animation.Storyboard)this.FindName("LoginGridAppear"); LoginGridDisappear = (Windows.UI.Xaml.Media.Animation.Storyboard)this.FindName("LoginGridDisappear"); InfoAppear = (Windows.UI.Xaml.Media.Animation.Storyboard)this.FindName("InfoAppear"); InfoDisappear = (Windows.UI.Xaml.Media.Animation.Storyboard)this.FindName("InfoDisappear"); MainPanel = (Windows.UI.Xaml.Controls.StackPanel)this.FindName("MainPanel"); LoginGrid = (Windows.UI.Xaml.Controls.Grid)this.FindName("LoginGrid"); InfoGrid = (Windows.UI.Xaml.Controls.Grid)this.FindName("InfoGrid"); TitleInfoTbx = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("TitleInfoTbx"); SubtitleInfoTbx = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("SubtitleInfoTbx"); SummaryInfoTbx = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("SummaryInfoTbx"); LoginProgbar = (Windows.UI.Xaml.Controls.ProgressBar)this.FindName("LoginProgbar"); UsernameTBx = (Windows.UI.Xaml.Controls.TextBox)this.FindName("UsernameTBx"); PwBx = (Windows.UI.Xaml.Controls.PasswordBox)this.FindName("PwBx"); LoginBtn = (Windows.UI.Xaml.Controls.Button)this.FindName("LoginBtn"); SignUpBtn = (Windows.UI.Xaml.Controls.Button)this.FindName("SignUpBtn"); AlbumArtHolder = (Windows.UI.Xaml.Controls.Image)this.FindName("AlbumArtHolder"); SongTitle = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("SongTitle"); Artist = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("Artist"); LoveBtn = (Windows.UI.Xaml.Controls.Button)this.FindName("LoveBtn"); BanBtn = (Windows.UI.Xaml.Controls.Button)this.FindName("BanBtn"); Collection = (Windows.UI.Xaml.Controls.Button)this.FindName("Collection"); RecoArtistsButton = (Windows.UI.Xaml.Controls.Button)this.FindName("RecoArtistsButton"); RecoTracksButton = (Windows.UI.Xaml.Controls.Button)this.FindName("RecoTracksButton"); TrendsButton = (Windows.UI.Xaml.Controls.Button)this.FindName("TrendsButton"); TweetButton = (Windows.UI.Xaml.Controls.Button)this.FindName("TweetButton"); MapButton = (Windows.UI.Xaml.Controls.Button)this.FindName("MapButton"); MuConnectButton = (Windows.UI.Xaml.Controls.Button)this.FindName("MuConnectButton"); InfoBtn = (Windows.UI.Xaml.Controls.Button)this.FindName("InfoBtn"); }
private void LoadStoryBoardSwitch() { //ToGridView _sbGridView = new Windows.UI.Xaml.Media.Animation.Storyboard(); _sbGridView.Children.Add(WinAppLibrary.Utilities.AnimationHelper.CreateTranslateXAnimation(TranTransScroll, 0, Lib.Threshold.ANIMATION_TIME)); _sbGridView.Children.Add(WinAppLibrary.Utilities.AnimationHelper.CreateOpacityAnimation(gvDrawing, 1, 0, Lib.Threshold.ANIMATION_TIME)); _sbGridView.Children.Add(WinAppLibrary.Utilities.AnimationHelper.CreateScaleXAnimation(ScaleTransScroll, 1, Lib.Threshold.ANIMATION_TIME)); _sbGridView.Children.Add(WinAppLibrary.Utilities.AnimationHelper.CreateScaleYAnimation(ScaleTransScroll, 1, Lib.Threshold.ANIMATION_TIME)); _sbGridView.Children.Add(WinAppLibrary.Utilities.AnimationHelper.CreateTranslateXAnimation(TranTransFlip, -LayoutRoot.ActualWidth / 2, Lib.Threshold.ANIMATION_TIME)); _sbGridView.Children.Add(WinAppLibrary.Utilities.AnimationHelper.CreateOpacityAnimation(FlipView, 0, 0, Lib.Threshold.ANIMATION_TIME)); _sbGridView.Children.Add(WinAppLibrary.Utilities.AnimationHelper.CreateScaleXAnimation(ScaleTransFlip, 0, Lib.Threshold.ANIMATION_TIME)); _sbGridView.Children.Add(WinAppLibrary.Utilities.AnimationHelper.CreateScaleYAnimation(ScaleTransFlip, 0, Lib.Threshold.ANIMATION_TIME)); //To FlipView _sbScreenView = new Windows.UI.Xaml.Media.Animation.Storyboard(); _sbScreenView.Children.Add(WinAppLibrary.Utilities.AnimationHelper.CreateTranslateXAnimation(TranTransScroll, -LayoutRoot.ActualWidth / 2, Lib.Threshold.ANIMATION_TIME)); _sbScreenView.Children.Add(WinAppLibrary.Utilities.AnimationHelper.CreateOpacityAnimation(gvDrawing, 0, 0, Lib.Threshold.ANIMATION_TIME)); _sbScreenView.Children.Add(WinAppLibrary.Utilities.AnimationHelper.CreateScaleXAnimation(ScaleTransScroll, 0, Lib.Threshold.ANIMATION_TIME)); _sbScreenView.Children.Add(WinAppLibrary.Utilities.AnimationHelper.CreateScaleYAnimation(ScaleTransScroll, 0, Lib.Threshold.ANIMATION_TIME)); _sbScreenView.Children.Add(WinAppLibrary.Utilities.AnimationHelper.CreateTranslateXAnimation(TranTransFlip, 0, Lib.Threshold.ANIMATION_TIME)); _sbScreenView.Children.Add(WinAppLibrary.Utilities.AnimationHelper.CreateOpacityAnimation(FlipView, 1, 0, Lib.Threshold.ANIMATION_TIME)); _sbScreenView.Children.Add(WinAppLibrary.Utilities.AnimationHelper.CreateScaleXAnimation(ScaleTransFlip, 1, Lib.Threshold.ANIMATION_TIME)); _sbScreenView.Children.Add(WinAppLibrary.Utilities.AnimationHelper.CreateScaleYAnimation(ScaleTransFlip, 1, Lib.Threshold.ANIMATION_TIME)); }
private void UpdateNextItem() { //Check if there's more than one item. if not, don't start animation bool hasTwoOrMoreItems = false; if (ItemsSource is IEnumerable) { var enumerator = (ItemsSource as IEnumerable).GetEnumerator(); int count = 0; while (enumerator.MoveNext()) { count++; if (count > 1) { hasTwoOrMoreItems = true; break; } } } if (!hasTwoOrMoreItems) { return; } var sb = new Windows.UI.Xaml.Media.Animation.Storyboard(); if (_translate != null) { var anim = new Windows.UI.Xaml.Media.Animation.DoubleAnimation(); anim.Duration = new Duration(TimeSpan.FromMilliseconds(500)); anim.From = 0; if (Direction == LiveTile.SlideDirection.Up) { anim.To = -this.ActualHeight; } else if (Direction == LiveTile.SlideDirection.Left) { anim.To = -this.ActualWidth; } anim.FillBehavior = Windows.UI.Xaml.Media.Animation.FillBehavior.HoldEnd; anim.EasingFunction = new Windows.UI.Xaml.Media.Animation.CubicEase() { EasingMode = Windows.UI.Xaml.Media.Animation.EasingMode.EaseOut }; Windows.UI.Xaml.Media.Animation.Storyboard.SetTarget(anim, _translate); if (Direction == LiveTile.SlideDirection.Up // || this.SlideDirection == SlideView.SlideDirection.Down ) { Windows.UI.Xaml.Media.Animation.Storyboard.SetTargetProperty(anim, "Y"); } else { Windows.UI.Xaml.Media.Animation.Storyboard.SetTargetProperty(anim, "X"); } sb.Children.Add(anim); } sb.Completed += (a, b) => { //Reset back and swap images, getting the next image ready sb.Stop(); if (_translate != null) { _translate.X = _translate.Y = 0; } if (_currentElement != null) { _currentElement.DataContext = GetCurrent(); } if (_nextElement != null) { _nextElement.DataContext = GetNext(); } }; sb.Begin(); }
private void UpdateNextItem() { var sb = new Windows.UI.Xaml.Media.Animation.Storyboard(); if (_translate != null) { var anim = new Windows.UI.Xaml.Media.Animation.DoubleAnimation(); anim.Duration = new Duration(TimeSpan.FromMilliseconds(500)); anim.From = 0; if(Direction == LiveTile.SlideDirection.Up) anim.To = -this.ActualHeight; else if (Direction == LiveTile.SlideDirection.Left) anim.To = -this.ActualWidth; anim.FillBehavior = Windows.UI.Xaml.Media.Animation.FillBehavior.HoldEnd; anim.EasingFunction = new Windows.UI.Xaml.Media.Animation.CubicEase() { EasingMode = Windows.UI.Xaml.Media.Animation.EasingMode.EaseOut }; Windows.UI.Xaml.Media.Animation.Storyboard.SetTarget(anim, _translate); if(Direction == LiveTile.SlideDirection.Up // || this.SlideDirection == SlideView.SlideDirection.Down ) Windows.UI.Xaml.Media.Animation.Storyboard.SetTargetProperty(anim, "Y"); else Windows.UI.Xaml.Media.Animation.Storyboard.SetTargetProperty(anim, "X"); sb.Children.Add(anim); } sb.Completed += (a, b) => { //Reset back and swap images, getting the next image ready sb.Stop(); if (_translate != null) { _translate.X = _translate.Y = 0; } if(_currentElement != null) _currentElement.DataContext = GetCurrent(); if(_nextElement != null) _nextElement.DataContext = GetNext(); }; sb.Begin(); }
private void LoadStoryBoardSwitch() { _sbPopupON = new Windows.UI.Xaml.Media.Animation.Storyboard(); _sbPopupON.Children.Add(WinAppLibrary.Utilities.AnimationHelper.CreateScaleXAnimation(offDataUpdatePanelScale, 1, ANIMATION_SPEED)); _sbPopupON.Children.Add(WinAppLibrary.Utilities.AnimationHelper.CreateScaleYAnimation(offDataUpdatePanelScale, 1, ANIMATION_SPEED)); _sbPopupOFF = new Windows.UI.Xaml.Media.Animation.Storyboard(); _sbPopupOFF.Children.Add(WinAppLibrary.Utilities.AnimationHelper.CreateScaleXAnimation(offDataUpdatePanelScale, 0, ANIMATION_SPEED)); _sbPopupOFF.Children.Add(WinAppLibrary.Utilities.AnimationHelper.CreateScaleYAnimation(offDataUpdatePanelScale, 0, ANIMATION_SPEED)); }
private void LoadStoryBoardSwitch() { //ToGridView _sbGridView = new Windows.UI.Xaml.Media.Animation.Storyboard(); _sbGridView.Children.Add(WinAppLibrary.Utilities.AnimationHelper.CreateTranslateXAnimation(TranTransScroll, 0, ANIMATION_SPEED)); _sbGridView.Children.Add(WinAppLibrary.Utilities.AnimationHelper.CreateOpacityAnimation(ScrollViewer, 1, 0, ANIMATION_SPEED)); _sbGridView.Children.Add(WinAppLibrary.Utilities.AnimationHelper.CreateScaleXAnimation(ScaleTransScroll, 1, ANIMATION_SPEED)); _sbGridView.Children.Add(WinAppLibrary.Utilities.AnimationHelper.CreateScaleYAnimation(ScaleTransScroll, 1, ANIMATION_SPEED)); _sbGridView.Children.Add(WinAppLibrary.Utilities.AnimationHelper.CreateTranslateXAnimation(TranTransFlip, -LayoutRoot.ActualWidth / 2, ANIMATION_SPEED)); _sbGridView.Children.Add(WinAppLibrary.Utilities.AnimationHelper.CreateOpacityAnimation(this.FlipView, 0, 0, ANIMATION_SPEED)); _sbGridView.Children.Add(WinAppLibrary.Utilities.AnimationHelper.CreateScaleXAnimation(ScaleTransFlip, 0, ANIMATION_SPEED)); _sbGridView.Children.Add(WinAppLibrary.Utilities.AnimationHelper.CreateScaleYAnimation(ScaleTransFlip, 0, ANIMATION_SPEED)); //To FlipView _sbFlipView = new Windows.UI.Xaml.Media.Animation.Storyboard(); _sbFlipView.Children.Add(WinAppLibrary.Utilities.AnimationHelper.CreateTranslateXAnimation(TranTransScroll, -LayoutRoot.ActualWidth / 2, ANIMATION_SPEED)); _sbFlipView.Children.Add(WinAppLibrary.Utilities.AnimationHelper.CreateOpacityAnimation(ScrollViewer, 0, 0, ANIMATION_SPEED)); _sbFlipView.Children.Add(WinAppLibrary.Utilities.AnimationHelper.CreateScaleXAnimation(ScaleTransScroll, 0, ANIMATION_SPEED)); _sbFlipView.Children.Add(WinAppLibrary.Utilities.AnimationHelper.CreateScaleYAnimation(ScaleTransScroll, 0, ANIMATION_SPEED)); _sbFlipView.Children.Add(WinAppLibrary.Utilities.AnimationHelper.CreateTranslateXAnimation(TranTransFlip, 0, ANIMATION_SPEED)); _sbFlipView.Children.Add(WinAppLibrary.Utilities.AnimationHelper.CreateOpacityAnimation(this.FlipView, 1, 0, ANIMATION_SPEED)); _sbFlipView.Children.Add(WinAppLibrary.Utilities.AnimationHelper.CreateScaleXAnimation(ScaleTransFlip, 1, ANIMATION_SPEED)); _sbFlipView.Children.Add(WinAppLibrary.Utilities.AnimationHelper.CreateScaleYAnimation(ScaleTransFlip, 1, ANIMATION_SPEED)); }
private void LoadStoryBoardSwitch() { //ToGridView _sbGridView = new Windows.UI.Xaml.Media.Animation.Storyboard(); _sbGridView.Children.Add(WinAppLibrary.Utilities.AnimationHelper.CreateOpacityAnimation(this.FlipView, 0, 0, 0)); _sbGridView.Children.Add(WinAppLibrary.Utilities.AnimationHelper.CreateTranslateXAnimation(TranTransFlip, -1200, ANIMATION_SPEED)); _sbGridView.Children.Add(WinAppLibrary.Utilities.AnimationHelper.CreateTranslateXAnimation(TranTransLv, 0, ANIMATION_SPEED)); //To FlipView _sbFlipView = new Windows.UI.Xaml.Media.Animation.Storyboard(); _sbFlipView.Children.Add(WinAppLibrary.Utilities.AnimationHelper.CreateOpacityAnimation(this.FlipView, 1, 0, 0)); _sbFlipView.Children.Add(WinAppLibrary.Utilities.AnimationHelper.CreateTranslateXAnimation(TranTransFlip, 0, ANIMATION_SPEED)); _sbFlipView.Children.Add(WinAppLibrary.Utilities.AnimationHelper.CreateTranslateXAnimation(TranTransLv, -400, ANIMATION_SPEED)); _sbUnAssignSortOFF = new Windows.UI.Xaml.Media.Animation.Storyboard(); _sbUnAssignSortOFF.Children.Add(WinAppLibrary.Utilities.AnimationHelper.CreateScaleYAnimation(ScaleTransUnAssignSort, 0, ANIMATION_SPEED)); _sbUnAssignSortON = new Windows.UI.Xaml.Media.Animation.Storyboard(); _sbUnAssignSortON.Children.Add(WinAppLibrary.Utilities.AnimationHelper.CreateScaleYAnimation(ScaleTransUnAssignSort, 1, ANIMATION_SPEED)); _sbAssignSortOFF = new Windows.UI.Xaml.Media.Animation.Storyboard(); _sbAssignSortOFF.Children.Add(WinAppLibrary.Utilities.AnimationHelper.CreateScaleYAnimation(ScaleTransAssignSort, 0, ANIMATION_SPEED)); _sbAssignSortON = new Windows.UI.Xaml.Media.Animation.Storyboard(); _sbAssignSortON.Children.Add(WinAppLibrary.Utilities.AnimationHelper.CreateScaleYAnimation(ScaleTransAssignSort, 1, ANIMATION_SPEED)); }
private void UpdateNextItem() { //Check if there's more than one item. if not, don't start animation bool hasTwoOrMoreItems = false; if (ItemsSource is IEnumerable) { var enumerator = (ItemsSource as IEnumerable).GetEnumerator(); int count = 0; while(enumerator.MoveNext()) { count++; if (count > 1) { hasTwoOrMoreItems = true; break; } } } if (!hasTwoOrMoreItems) return; var sb = new Windows.UI.Xaml.Media.Animation.Storyboard(); if (_translate != null) { var anim = new Windows.UI.Xaml.Media.Animation.DoubleAnimation(); anim.Duration = new Duration(TimeSpan.FromMilliseconds(500)); anim.From = 0; if(Direction == LiveTile.SlideDirection.Up) anim.To = -this.ActualHeight; else if (Direction == LiveTile.SlideDirection.Left) anim.To = -this.ActualWidth; anim.FillBehavior = Windows.UI.Xaml.Media.Animation.FillBehavior.HoldEnd; anim.EasingFunction = new Windows.UI.Xaml.Media.Animation.CubicEase() { EasingMode = Windows.UI.Xaml.Media.Animation.EasingMode.EaseOut }; Windows.UI.Xaml.Media.Animation.Storyboard.SetTarget(anim, _translate); if(Direction == LiveTile.SlideDirection.Up // || this.SlideDirection == SlideView.SlideDirection.Down ) Windows.UI.Xaml.Media.Animation.Storyboard.SetTargetProperty(anim, "Y"); else Windows.UI.Xaml.Media.Animation.Storyboard.SetTargetProperty(anim, "X"); sb.Children.Add(anim); } sb.Completed += (a, b) => { //Reset back and swap images, getting the next image ready sb.Stop(); if (_translate != null) { _translate.X = _translate.Y = 0; } if(_currentElement != null) _currentElement.DataContext = GetCurrent(); if(_nextElement != null) _nextElement.DataContext = GetNext(); }; sb.Begin(); }