Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > Avalon

Vista - problem after animation has been applied

 
 
Old 04-25-2006   #1 (permalink)
Ranj


 
 

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


 
 

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


 
 

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


 
 

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


 
 

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
 

Thread Tools


Similar Threads
Thread Forum
Animation problem :( Vista General
GPO not applied Vista General
GPO not applied Vista General


Vista Forums 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 Ltd

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