Making a dot move in a sinusoidal way, side-to-side

Discussion in 'Programming General' started by Nathan III, May 2, 2020.

Making a dot move in a sinusoidal way, side-to-side
  1. Unread #1 - May 2, 2020 at 5:29 PM
  2. Nathan III
    Joined:
    Jan 24, 2007
    Posts:
    872
    Referrals:
    0
    Sythe Gold:
    0

    Nathan III Apprentice

    Making a dot move in a sinusoidal way, side-to-side

    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!
     
  3. Unread #2 - May 3, 2020 at 12:45 PM
  4. Pirate
    Joined:
    Aug 14, 2016
    Posts:
    16,736
    Referrals:
    14
    Sythe Gold:
    990
    Vouch Thread:
    Click Here
    Discord Unique ID:
    219503210560225280
    Discord Username:
    Pirate#0069
    Detective Two Factor Authentication User Staff of the Quarter Winner St. Patrick's Day 2024 Hoover The Glizz Verified Ironman Dragon Claws Nitro Booster (3)
    WoW Classic

    Pirate

    Making a dot move in a sinusoidal way, side-to-side

  5. Unread #3 - Aug 7, 2020 at 3:12 PM
  6. Haunting
    Joined:
    Mar 1, 2016
    Posts:
    13
    Referrals:
    0
    Sythe Gold:
    3

    Haunting Newcomer

    Making a dot move in a sinusoidal way, side-to-side

    What's the exact issue? That equation works fine for moving around an origin sinusoidally.
    Desmos | Graphing Calculator
    o = origin, a = amplitude, f = frequency, t = time.

    Is your question on the time? For that you'd just track the change in time between update calls and add that to your time counter. Good news if you don't even have to worry about bounding your t.
     
< Why does this happen to me? | Need discord gold selling server made >

Users viewing this thread
1 guest


 
 
Adblock breaks this site