2

I need to animate translations of elements over paths such as the one shown below:

De Casteljau's curve example

Right now I am using a requestAnimationFrame callback that calculates the position on a De Casteljau curve and then sets the element position via an inline CSS translate3d().
This works, although it performs worse and is very verbose when compared to CSS animations.

Web Animations seem like a good new option to animate elements when the destination is only known at runtime, but I cannot find anything to modify the animation between the start and end point.

Is it possible to do the above using element.animate(), or is it no more customisable than a CSS animation?

Razor
  • 27,418
  • 8
  • 53
  • 76
  • HTML5 offers a bezier function for canvas drawing but that probably is not suitable for you as you talk about moving elements (not just dots). – Paul Oct 15 '14 at 11:36

1 Answers1

0

With Web Animation API you could use motion-path property:

More information and live example here:

http://danielcwilson.com/blog/2015/09/animations-part-5/

https://codepen.io/danwilson/post/css-motion-paths

https://webdesigner-webdeveloper.com/weblog/exploring-web-animations/

GibboK
  • 71,848
  • 143
  • 435
  • 658