plethora icon indicating copy to clipboard operation
plethora copied to clipboard

[Feature Request] Interpolation

Open Galaxtone opened this issue 6 years ago • 4 comments

I'd want some way to move a box to a new position with a gliding motion, I know that internally the games achieves this by using linear interpolation with frame delta, and that's the exact motion I refer to, This would allow canvas3d animations to be smooth, maybe some way to apply a duration to an action.

Galaxtone avatar Apr 16 '19 20:04 Galaxtone

With durations, e.g.,

while true do
  angle = angle + (math.pi / 4)
  box.setPosition(math.cos(angle), math.sin(angle), 10)
  sleep(10)
end

moving 45 degrees every 10 seconds, it would interpolate linearly between each action forming a octagon in the movement.

Galaxtone avatar Apr 16 '19 21:04 Galaxtone

If you're going to interpolate, at least provide easing functions, as purely linear interpolation is generally bad for UX for non-infinite cases

Lemmmy avatar Apr 16 '19 22:04 Lemmmy

@Lemmmy I'm not trying to ask for linear interpolation specifically, I just want to bring up the topic of interpolation for consideration of easing implementations.

Off the top of my head, Let's assume some API like this: box.ease("type", {position}) like "linear" and "beizer" and other sorts of curves, maybe a function to view types of eases.

This would really be useful for animation without constantly sending coordinate positions, would be especially nice once rotation transform is added.

Galaxtone avatar Apr 17 '19 17:04 Galaxtone

Perhaps the easing function should be an optional argument at the end of the command it applies to. box.setPosition(x:number, y:number, [ease:string])

nevercast avatar May 18 '19 06:05 nevercast