We have animations, we need to interpolate values. There are two common methods: linear equation and curve-based interpolation. As simpler and more appropriate for ASCII GAME ENGINE we used to implement linear interpolation.
Design
Empirical formula is:
interpolated = value1 + (value2 - value1) / (time2 - time1) * (current_time - time1)
Where:
(time1, value1) and (time2, value2) are keyframes
current_time is current local time of animation (between two bounding keyframes)
Implementation details
For now it's enough to implement interpolation for next types
int, float
utils.Point
Split Animation.update method to two for interpolated and fixed (discrete) animation.
This needed due to different approaches to animation keyframe switching and will too
complicate code to keep single codepass.
Abstract
We have animations, we need to interpolate values. There are two common methods: linear equation and curve-based interpolation. As simpler and more appropriate for ASCII GAME ENGINE we used to implement linear interpolation.
Design
Empirical formula is: interpolated = value1 + (value2 - value1) / (time2 - time1) * (current_time - time1) Where:
Implementation details
For now it's enough to implement interpolation for next types
Split Animation.update method to two for interpolated and fixed (discrete) animation. This needed due to different approaches to animation keyframe switching and will too complicate code to keep single codepass.