Python Forum
making dot move in a sinusoidal way - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: making dot move in a sinusoidal way (/thread-26471.html)



making dot move in a sinusoidal way - philpsypol - May-02-2020

Hi folks,

I am trying to move a dot side-to-side in Python, using the following equation: x_coordinates = 0 + (amplitude * sin(frequency*current time*2pi)). Does anyone have any ideas on how I might go about achieving this? I have searched for hours and I'm not even sure how to phrase the question succinctly enough for Google to comprehend!


RE: making dot move in a sinusoidal way - deanhystad - May-03-2020

How do you want to display your sinusoidal output? Turtle graphics? Multiple print statements to the console? Something else?


RE: making dot move in a sinusoidal way - philpsypol - May-03-2020

(May-03-2020, 03:28 AM)deanhystad Wrote: How do you want to display your sinusoidal output? Turtle graphics? Multiple print statements to the console? Something else?

Thanks for the reply! I would like to display it as an object, whereby the x axis position at each frame is determined by the output of the equation above.


RE: making dot move in a sinusoidal way - deanhystad - May-03-2020

How do you want to display the output? Your program will need to draw something. TO do this it needs to use a package that supports graphics. There are a lot of graphics packages in python.