Boman

just looked at this earlier post ...
http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=169533&SiteID=1

IĄŻam "visual" guy that is playing / trying to get the hang of WPF ..
I made a small app for displaying video ( using canvas and left / top properties and some keyboard inputs ) but would
like it to be more scaleable .. What i need/would like to see an example of is :
- a function you could give some/a point value/s an a framework element ..
so that it would animate from the current pos - to the one given. using translate.

once agian .. what I have/ or would like to have is a Grid containing a horisontal stack with some mediaelements
and when you press the the left and right arrow key it animates to center a new mediaelement ..
The "only" thing Iam missing is the code behind animation of translate points ..

Can anyone help me please with some "code behind" :D

IĄŻam missing a real AAAhhh-experience :D



Re: Windows Presentation Foundation (WPF) about animation in WPF. Have anyone made a dll or funciton for chanceing translate points/scaling that they what to share :D

Boman

okay .... now I have startet solving my own problem :D .. ( And I have gotten things moving BUT .. )
Now a new problem came up ... here is my function so far ( see below ) ... My problem is now that if I start another DoubleAnimation
on the same frameworkElement , a simular function that just uses ScaleTransform instead then the move one gets overruled or stops ..

Is is not possible to make 2 doubleanimations on the sametime on a framework element

and how is that done .. you can clearly see that I need help :D .. any sugestions :D

void mover(){

FrameworkElement oSender = rect;

double time = 1;

double xFrom = 0;
double xTo = 550;

double yFrom = 0;
double yTo = 550;

DoubleAnimation dx = new DoubleAnimation(xTo, TimeSpan.FromSeconds(time));
DoubleAnimation dy = new DoubleAnimation(yTo, TimeSpan.FromSeconds(time));
//dx.RepeatBehavior = RepeatBehavior.Forever;
//dy.RepeatBehavior = RepeatBehavior.Forever;
TranslateTransform r = new TranslateTransform();
r.X = xFrom;
r.Y = yFrom;
rect.RenderTransform = r;
r.BeginAnimation(
TranslateTransform.XProperty , dx);
r.BeginAnimation(
TranslateTransform.YProperty, dy);
}





Re: Windows Presentation Foundation (WPF) about animation in WPF. Have anyone made a dll or funciton for chanceing translate points/scaling that they what to share :D

Boman

ahhh I jet again found a solution at this page

http://blogs.msdn.com/karstenj/archive/2007/02/23/inspired-by-flash-math-creativity-2-wpf-planets.aspx

Just excellent work by Karsten Januszewski ------ now I just need a math degree :D

..What I needed was a TransformGroup:

TransformGroup tg = new TransformGroup();
ScaleTransform st = new ScaleTransform(1, 1, 5, 5);
TranslateTransform tt = new TranslateTransform();
tg.Children.Add(st);
tg.Children.Add(tt);