URGENT: Putting a 2d circle into my animation

48 views
Skip to first unread message

willg...@hotmail.co.uk

unread,
Dec 11, 2013, 5:20:51 PM12/11/13
to sage-s...@googlegroups.com
Please help, my coursework deadline is tomorrow.
I'm doing a piece on circular motion, I have a simple animation of a point moving in a circle, and a static circle I want the point to move around on but I want the circle to sit behind the animation so that it looks like the point is moving around the circle. Probably really simple but I'm struggling...
this is the code i have--

a = animate([point2d(((5*sin(i)),(5*cos(i))),rgbcolor=hue(1), size=30)for i in srange(0,2*pi,0.1)],xmin=-5,ymin=-5,xmax=5,ymax=5,figsize=[4,4])
b = circle((0,0),5)

a.show()
b.show()

John H Palmieri

unread,
Dec 11, 2013, 6:05:24 PM12/11/13
to sage-s...@googlegroups.com

How about this: define the circle "b" first, then animate "b+point2d(...)" instead of just "point2d(...)":

b = circle((0,0),5)
a = animate([b+point2d(((5*sin(i)),(5*cos(i))),rgbcolor=hue(1), size=30)for i in srange(0,2*pi,0.1)],xmin=-5,ymin=-5,xmax=5,ymax=5,figsize=[4,4])
a.show()

--
John

john_perry_usm

unread,
Dec 12, 2013, 12:32:32 PM12/12/13
to sage-s...@googlegroups.com
Does the zorder option do what you want?

Jason Grout

unread,
Dec 12, 2013, 12:36:11 PM12/12/13
to sage-s...@googlegroups.com
On 12/12/13, 11:32 AM, john_perry_usm wrote:
> Does the zorder option do what you want?

No, because they are making two different plots with the two different
show() calls.

John's solution should work, though.

Jason


Reply all
Reply to author
Forward
0 new messages