c# - Animating rectangle position in code using storyboard -
I am making C # / XAMML puzzle games on Windows Phone 8. I have a grid with rows and columns where there is a rectangle on each grid (I've added these rectangles on runtime)
I already have a code that is a rectangular in the second column or row Will move if I tap it.
I'm trying to make it a smooth animation transition using the storyboard.
Here is a code that does not work, but shows what I want to do.
Private Zero AnimateRectangle (rectangle rectangle, int sourceColumn, int.sorawarrow, int target column, int targetrope) {storyboard s = new storyboard (); Double animation double analogue = new double animation (); DoubleClick.com = sourceColumn; DoubleClick column To = target column; Double Annie Column Period = new duration (timespace from milliseconds (500)); Storyboard सर्टगेट (Double Annie Column, Rectangle); Storyboard CertificateProperties (Double Annie Column, New Property Path ("(Grid Set Column)")); Double animation double anneiro = new double animation (); Double aniro.fom = sourceRow; Double Aniero = Targets for; Doubleaenero.dition = new duration (timespace from milliseconds (500)); Storyboard सर्टिगेट (double aniro, rectangle); Storyboard CertificateProperty (double aniro, new property path ("(grid. Setro)")); S.Children.Add (doubleAniColumn); S.Children.Add (doubleAniRow); S.Begin (); Any help would be greatly appreciated.
OK, you type the grid. Line can not understand the property since 0.5 This is either line 0 or line 1. What you can do here is to animate its position and change the line and column once in a row:
Private zero animateRectangle (rectangle) Rectangle, int sourceColumn, int sourceRow, int targetColumn, int targetRow) {rectangle.RenderTransform = new CompositeTransform (); Storyboard S = New Storyboard (); Double animation double analogue = new double animation (); Double Annie Column From = 0; Double Annie Column For = ...; // Right calculation here right double anne column Period = new duration (timespace from milliseconds (500)); Storyboard सर्टगेट (Double Annie Column, Rectangle); Storyboard CertificateProperty (Double Annie Column, New Property Path ("(UIElement.RenderTransform). (Composite Transform. Translat Y)"); Double animation double anneiro = new double animation (); Double anarauform = 0; Double Aniero To = ...; // Calculate here the right offset double aniro.Dirication = new duration (timespace from milliseconds (500)); Storyboard सर्टिगेट (double aniro, rectangle); Storyboard CertificateProperty ("(UIElement.RenderTransform). (Composite Transform. Translatx)"; s.Children.Add (doubleAniColumn); s.Children.Add (doubleAniRow); EventHandler EventHandler = Null; EventHandler = (Sender , O) = & gt; {S.Completed - = eventHandler; grid. Satro (rectangle, goal line); grid .set column (rectangle, target column); Rectangle.RenderTransform = new composite conversion ();}; S.Completed + = EventHandler; s.Begin ();} I wrote this code from the top of my head, so do not worry Switch to that is not compiled anything before.
Comments
Post a Comment