jon86

Hi.

I am currently using Blend 2 September Preview to create a simple WPF app. I have created a filled eclipse (circle with a gradient) and an eclipse with no fill. I create a motion path from the eclipse with no fill and set it to the circle. The circle appears at 3 o'clock on the circle. How do I set it to 12 o'clock and to rotate in a clockwise motion Blend does not seem to allow me to just drag it round or change the motion path except drag it around the canvas/panel.


Thanks very much.
Jon


Re: Windows Presentation Foundation (WPF) Animated circular motion paths

AnotherDayAnotherSegFault

offset relevant Vector from your object,

add a double animation from 0 to 360 on the Axis angle...

in code would be something like:

public ModelVisual3D ApplyAnimation(ModelVisual3D modelToTransform)
{
AxisAngleRotation3D angler = new AxisAngleRotation3D(new Vector3D(0,1,0),0); // Choose relevant axis


RotateTransform3D tr3d =
new RotateTransform3D(angler,new Point3D(0.5, 0.5, 0.5)); // Change Point3D Offset as applicable

da = new System.Windows.Media.Animation.DoubleAnimation(0,360,
new Duration(TimeSpan.FromSeconds(8)),FillBehavior.Stop); // full spin


da.RepeatBehavior = RepeatBehavior.Forever;

angler.BeginAnimation(AxisAngleRotation3D.AngleProperty, da);

tgroup = new Transform3DGroup();

tgroup.Children.Add(modelToTransform.Transform); // defensively add existing transforms...

tgroup.Children.Add(tr3d);


modelToTransform.Transform = tgroup; // spin it.

return modelToTransform; // optionally return entire model

}

hope this helps...





Re: Windows Presentation Foundation (WPF) Animated circular motion paths

jon86

What do you mean by "offset relevant Vector from your object" If I create two keyframes, one at time = 0 and one at time = 2 and set the circle at time = 2 to have rotated by 360 degrees, the circle spins on it's own axis. I want the circle to rotate on the path of a (much bigger) circle.

Instead of the dot spinning on it's axis, I want it to spin round the parenthesis: ( . )

I am guessing I need a translate animation, as opposed to a rotate animation.




Re: Windows Presentation Foundation (WPF) Animated circular motion paths

AnotherDayAnotherSegFault

half the total amount you want to rotate to get a center.

C = 2*pi*R

A = pi*R*R

or to keep it simple I want to rotate around point A by amount B

Lets say A is 0

And B is 4

So I offset my model in any direction using a TranslateTransform FIRST

of 2 ensuring that I set the center of my transform to the very opposite edge of the model than the direction im transforming

say my model is 2x2x2 I set the transform center to 0,1,1

then Im all set to apply a further TranslateTranslation over that

situated around my objects new actual center moving it to wherever I want to spin it round - in this case perhaps just a nudge either way...

finally I apply the rotation to the model on the relevant axis as I am now offset from my center sufficiently.

So I would suggest you need a sequence of Triggers setup that instantly do the first two stages.

Then spin it,

Then Instantly transform it back when its done.

Hope this Helps.

Si.





Re: Windows Presentation Foundation (WPF) Animated circular motion paths

AnotherDayAnotherSegFault

Im pretty sure you can get similr results with my first code tho... Ill have to check