Animating morphing Bezier curves; saving points

• To: mathgroup at smc.vnet.net
• Subject: [mg124546] Animating morphing Bezier curves; saving points
• From: Chris Young <cy56 at comcast.net>
• Date: Tue, 24 Jan 2012 05:07:04 -0500 (EST)
• Delivered-to: l-mathgroup@mail-archive0.wolfram.com

```The problem is that every time I start the animation, I lose the
positions of my points.

http://home.comcast.net/~cy56/Mma/MorphingB=C3=A9zier.nb
http://home.comcast.net/~cy56/Mma/MorphingB=C3=A9zierPic.png

Manipulate[
DynamicModule[
{
P == {      (*
all the points *)
{-1, -1}, {-1, -.5}, {-1, 0}, {-1, .5}, {-1, 1},
{  1, -1}, {   1, -.5}, {  1, 0}, {   1, .5}, {  1, 1}
},
P1, P2,   (* the points for each B=C3=A9zier curve *)
C1, C2,   (*
the B=C3=A9zier curves *)
PM,           (*
the points for the morphing B=C3=A9zier curve *)
CM              (*
the morphing B=C3=A9zier curve *)
},

LocatorPane[
Dynamic[P],

P1 == Dynamic @ Take[P, {1, 5}];
P2 == Dynamic @ Take[P, {6, 10}];

PM[n_] == (1 - n) P1 + n P2;

C1 == BezierCurve[P1, SplineDegree -> 5];
C2 == BezierCurve[P2, SplineDegree -> 5];

CM[n_] == BezierCurve[PM[n], SplineDegree -> 5];

Graphics[
{
Thick,
Red, C1,
Blue, C2,
Purple, CM[n],

Thin, Black, Dashed,
Line[P1],
Line[P2]
},
Axes -> True,
PlotRange -> {{-1, 1}, {-1, 1}},
GridLines -> {Range[-1, 1, .25], Range[-1, 1, .25]},
GridLinesStyle -> LightGray
],
{{-1, -1}, {1, 1}, {.25, .25}},
LocatorAutoCreate -> True
]
],
{{n, 0}, 0, 1}
]

```

• Prev by Date: Re: exercises: suppress printing of answers
• Next by Date: Mathematica 8 + OS X + McAfee = trouble; help?
• Previous by thread: Re: Compile function and AppendTo for lists (vrs. 8.0.4)
• Next by thread: Re: Animating morphing Bezier curves; saving points