Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

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.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > Avalon

problem after animation has been applied

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 04-25-2006   #1 (permalink)
Ranj
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 SpecsSystem Spec
Old 04-28-2006   #2 (permalink)
Ranj
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 SpecsSystem Spec
Old 04-28-2006   #3 (permalink)
Marcus
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 SpecsSystem Spec
Old 04-28-2006   #4 (permalink)
viliescu
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 SpecsSystem Spec
Old 05-02-2006   #5 (permalink)
Ranj
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 SpecsSystem Spec
Closed Thread

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


Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51