Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8871653
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T18:02:35+00:00 2026-06-14T18:02:35+00:00

I’m working on a project that uses the following easing function to move objects

  • 0

I’m working on a project that uses the following easing function to move objects on the screen:

function easeinoutquart(t,b,c,d) as float
    't=time, b=startvalue, c=change in value, d=duration
    d=d/2
    t=t/d
    if (t < 1) then 
        return c/2*t*t*t*t + b
    end if
    t=t-2
    return -c/2 * (t*t*t*t - 2) + b
end function

I keep running into situations where the values go rapidly out of bounds resulting in objects moving offscreen at dizzying speeds. The first situation seemed to be caused by truncating the results of the function to integer values, which I fixed. The next thing that triggered the exact same behavior seemed to be when the time value was not reset after the objects came to rest and a new easing distance was entered. Once I added a reset after changing the destination value (change=destination-start) this seemed to fix the problem completely.

Now I’ve added more code to the loop that downloads and swaps out images. It appears that the added execution time in the loop sometimes causes the values to go out of bounds, creating the same blur of images rushing off screen.

To describe the code briefly:

loop
   check for user input (up down left right select) 
      if so set new dest position for all images, reset timer for all images
      if a new image is selected on screen, load related content, reset related content timer

      is there an image in the queue to download? if so get initiate async download
      are any images downloaded? If so swap out temp image with final image

      call easing function for primary images (vertical movement on y axis)
      call easing function for related content (horizontal movement on x axis)
      draw all graphics and swap display buffer
end loop

Prior to adding the image download/swap (the actual swap is just changing a pointer) code, everything was working great with both preloaded images and temp images. Now that I’m loading temp images first and swapping, I think that the loop is somtimes executing in more than 1/30th of a second and perhaps this is causing timer values to get weird.

So essentially, I’m wondering if there are some kind of “governer” clamps I can put on values that will keep the easing function from generating crazy values that rapidly get out of control. For example, the total distance moved should never more than 250 pixels in a single iteration, in fact should always be just a few pixels towards the destination value.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T18:02:36+00:00Added an answer on June 14, 2026 at 6:02 pm

    While i’m certain I did not ask this question well, I have finally found the answer. The issue I was encountering was caused by the value of time being greater than the value of duration.

    In the above function, you don’t feed in the destination value, just the current value and the difference between the start and destination. The solution I came up with is: if execution time between calls to the easing function go beyond the maximum allowable duration value allowed for the easing to complete, then just set the start value to be equal to destination value.

    time is the number of milliseconds since the easing function was initiated:

    change=destination-currentposition
    currentposition=inoutquart(time,currentposition,change,duration)
    if time > duration then startarray[i]=destarray[i]
    

    So this way, we clamp the output value to the destination position if time exceeds duration.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I need a function that will clean a strings' special characters. I do NOT
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I've got a string that has curly quotes in it. I'd like to replace
I have a small JavaScript validation script that validates inputs based on Regex. I
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I have a French site that I want to parse, but am running into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.