Jump to content
Search Community

Search the Community

Showing results for tags 'animation acceleration'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • GreenSock Forums
    • GSAP
    • Banner Animation
    • Jobs & Freelance
  • Flash / ActionScript Archive
    • GSAP (Flash)
    • Loading (Flash)
    • TransformManager (Flash)

Product Groups

  • Club GreenSock
  • TransformManager
  • Supercharge

Categories

There are no results to display.


Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Personal Website


Twitter


CodePen


Company Website


Location


Interests

Found 1 result

  1. You asked for a demo posted to the forums on Twitter, so here it is. The important bit is this function: const calcAccel = (x, v, maxA, dt) => { if(dt === 0) return 0; const signX = (x < 0)?-1:1; const a = signX * (Math.sqrt(Math.abs(1 + (2 * x) / (maxA * dt * dt))) * maxA - (v * signX) / dt - maxA); return Math.min(maxA, Math.max(-maxA, a)); } It takes a distance, velocity, maximum acceleration and time delta and returns the acceleration that needs to be applied to reach the destination and stop there given acceleration and velocity constraints. The attractive part of this is that the destination can be changed at will and the formula will always work out. And if the acceleration and velocity constraints are such as to prevent exactly stopping on the target, it will simply overshoot and correct. I've come to this after first trying to apply tweening to my problem. But perhaps this can be wrapped into a custom tween. Basic demo: http://codepen.io/killroy/pen/jyaKYo Real-world demo: http://codepen.io/killroy/pen/MJvGLW I've developed it for various applications in an RTS game (such as turning turrets and ship motion), but I constantly find other applications for it. Cheers!
×
×
  • Create New...