![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | problem after animation has been applied Hi I have the following problem: I have an Ellipse Geometry that I animate by updating its Translate Transfrom X and Y properties, the animation runs fine but when attempting to place the element from its current parent (Canvas) to a Stack Panel, the element is not visible in the stack panel though it seems like it has been added Stack Panel as height changes. If I do not apply the animation and just run the code to dock the element into the Stack Panel (DockIntoQueryStackPanel) then it all works fine Heres a snippet of the code private void animateToStackPanel(UIElement uiEl, int ii) { //apply animation to this venn circle FrameworkElement ctl = uiEl as FrameworkElement; Path path = uiEl as Path; EllipseGeometry eG = path.Data as EllipseGeometry; TranslateTransform tt = eG.Transform as TranslateTransform; if (tt.X > 0) { // create movement animation double endX = (this.MainGrid.ColumnDefinitions[0].ActualWidth / SizeSlider.Value) + (eG.RadiusX / SizeSlider.Value);// -tt.X;// -(this.MainGrid.ColumnDefinitions[1].ActualWidth / 5); double endY = (400 / SizeSlider.Value);//+ (eG.RadiusX / SizeSlider.Value);// -tt.X;// -(this.MainGrid.ColumnDefinitions[1].ActualWidth / 5); DoubleAnimation moveToStackX = new DoubleAnimation(tt.X, endX, new Duration(TimeSpan.FromSeconds(ii))); DoubleAnimation moveToStackY = new DoubleAnimation(tt.Y, endY, new Duration(TimeSpan.FromSeconds(ii))); String vName = "tt" + path.Name; if (this.FindName(vName) == null) { RegisterName(vName, tt); } //setup X animation Storyboard.SetTargetName(moveToStackX, vName); Storyboard.SetTargetProperty(moveToStackX, new PropertyPath(TranslateTransform.XProperty)); //setup Y animation Storyboard.SetTargetName(moveToStackY, vName); Storyboard.SetTargetProperty(moveToStackY, new PropertyPath(TranslateTransform.YProperty)); myStoryBoard.Children.Add(moveToStackX); myStoryBoard.Children.Add(moveToStackY); myStoryBoard.Completed += new EventHandler(myStoryBoard_Completed); myStoryBoard.Begin(path); } } void myStoryBoard_Completed(object sender, EventArgs e) { myStoryBoard.Children.Clear(); UIElement uiEl = (UIElement) elCollection.Pop(); //dropUIElement(el); DockIntoQueryStackPanel(uiEl); } Any help appreciated? Regards Ranjit |
My System Specs![]() |
| | #2 (permalink) |
| Guest | Re: problem after animation has been applied Just to let you know, I resolved this by Creating a new TranslationTransform settings its X and Y to 0 and applying that to the EllipseGeometry. For some unknown reason the X and Y of the TranslateTransform that were animated do not get updated, even if I explicity reset the X and Y in code to 0, there is no runtime error but just ignores the resetting to 0. "Ranj" <rsjoh@removethis.hotmail.com> wrote in message news:%231x3ozEaGHA.4548@TK2MSFTNGP04.phx.gbl... > Hi > > I have the following problem: > > I have an Ellipse Geometry that I animate by updating its Translate > Transfrom X and Y properties, > the animation runs fine but when attempting to place the element from its > current parent (Canvas) to a Stack Panel, the element is not visible in > the stack panel though it seems like it has been added Stack Panel as > height changes. > > If I do not apply the animation and just run the code to dock the element > into the Stack Panel (DockIntoQueryStackPanel) then it all works fine > > Heres a snippet of the code > > private void animateToStackPanel(UIElement uiEl, int ii) > { > //apply animation to this venn circle > FrameworkElement ctl = uiEl as FrameworkElement; > Path path = uiEl as Path; > EllipseGeometry eG = path.Data as EllipseGeometry; > TranslateTransform tt = eG.Transform as TranslateTransform; > > if (tt.X > 0) > { > // create movement animation > double endX = > (this.MainGrid.ColumnDefinitions[0].ActualWidth / SizeSlider.Value) + > (eG.RadiusX / > SizeSlider.Value);// -tt.X;// -(this.MainGrid.ColumnDefinitions[1].ActualWidth > / 5); > > double endY = (400 / SizeSlider.Value);//+ (eG.RadiusX / > SizeSlider.Value);// -tt.X;// -(this.MainGrid.ColumnDefinitions[1].ActualWidth > / 5); > DoubleAnimation moveToStackX = new DoubleAnimation(tt.X, > endX, new Duration(TimeSpan.FromSeconds(ii))); > DoubleAnimation moveToStackY = new DoubleAnimation(tt.Y, > endY, new Duration(TimeSpan.FromSeconds(ii))); > > String vName = "tt" + path.Name; > > if (this.FindName(vName) == null) > { > RegisterName(vName, tt); > } > //setup X animation > Storyboard.SetTargetName(moveToStackX, vName); > Storyboard.SetTargetProperty(moveToStackX, new > PropertyPath(TranslateTransform.XProperty)); > > //setup Y animation > Storyboard.SetTargetName(moveToStackY, vName); > Storyboard.SetTargetProperty(moveToStackY, new > PropertyPath(TranslateTransform.YProperty)); > > myStoryBoard.Children.Add(moveToStackX); > myStoryBoard.Children.Add(moveToStackY); > myStoryBoard.Completed += new > EventHandler(myStoryBoard_Completed); > myStoryBoard.Begin(path); > > } > > } > > void myStoryBoard_Completed(object sender, EventArgs e) > { > myStoryBoard.Children.Clear(); > > UIElement uiEl = (UIElement) elCollection.Pop(); > > //dropUIElement(el); > DockIntoQueryStackPanel(uiEl); > > } > > Any help appreciated? > > > Regards > Ranjit > > |
My System Specs![]() |
| | #3 (permalink) |
| Guest | Re: problem after animation has been applied After reading your reply, something crossed my mind... In the way the framework evaluate a property`s value, an animation has the precedence over everything else... see: http://windowssdk.msdn.microsoft.com...c07dad7ebc.asp There is a possibility that the property engine still evaluates the X and Y of the transform according to the animation, instead of the "local value"... By setting a new transform on the object (with X and Y of 0), you might be resetting this "weird" condition... If somebody has more insight/explanations over this, I would be interested in knowing the end of it... Thanks Marcus |
My System Specs![]() |
| | #4 (permalink) |
| Guest | Re: problem after animation has been applied Yes, it's because of the FillBehavior property for the Animations. By default is HoldEnd which means that after the animations ends, the property value is "frozen", you cannot change it by assignment. The solution is to set FillBehavior to Stop. -- Valentin Iliescu [MVP - Client Application Development] "Marcus" wrote: > After reading your reply, something crossed my mind... > > In the way the framework evaluate a property`s value, an animation has > the precedence over everything else... > > see: > http://windowssdk.msdn.microsoft.com...c07dad7ebc.asp > > There is a possibility that the property engine still evaluates the X > and Y of the transform according to the animation, instead of the > "local value"... > > By setting a new transform on the object (with X and Y of 0), you might > be resetting this "weird" condition... > > If somebody has more insight/explanations over this, I would be > interested in knowing the end of it... > > Thanks > > Marcus > > |
My System Specs![]() |
| | #5 (permalink) |
| Guest | Re: problem after animation has been applied Thanks for that its resolved the problem Ranj "viliescu" <viliescu@discussions.microsoft.com> wrote in message news:2909AE87-AD1F-451F-936C-3D961762CA0F@microsoft.com... > Yes, it's because of the FillBehavior property for the Animations. > By default is HoldEnd which means that after the animations ends, the > property value is "frozen", you cannot change it by assignment. The > solution > is to set FillBehavior to Stop. > -- > Valentin Iliescu [MVP - Client Application Development] > > > "Marcus" wrote: > >> After reading your reply, something crossed my mind... >> >> In the way the framework evaluate a property`s value, an animation has >> the precedence over everything else... >> >> see: >> http://windowssdk.msdn.microsoft.com...c07dad7ebc.asp >> >> There is a possibility that the property engine still evaluates the X >> and Y of the transform according to the animation, instead of the >> "local value"... >> >> By setting a new transform on the object (with X and Y of 0), you might >> be resetting this "weird" condition... >> >> If somebody has more insight/explanations over this, I would be >> interested in knowing the end of it... >> >> Thanks >> >> Marcus >> >> |
My System Specs![]() |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Problem binding animation to element in a template | mikesnoise@gmail.com | Avalon | 1 | 05-18-2007 11:36 AM |
| Animation problem :( | Chris May | Vista General | 3 | 12-08-2006 09:14 AM |
| GPO not applied | =?Utf-8?B?SmVycnk=?= | Vista General | 0 | 08-07-2006 03:51 PM |
| GPO not applied | otto@nospamserboucom.nl | Vista General | 0 | 08-07-2006 03:49 PM |
| GPO not applied | =?Utf-8?B?SmVycnk=?= | Vista General | 0 | 08-07-2006 03:43 PM |