I am trying to implement some of the easing functions but I am not sure where the duration comes from? Is it something that the user inputs or can it be computed? Does it depend on the start and end values?

有帮助吗?

解决方案

An easing function is mathematical calculation you use when animating a value. The value can be the position of an element on the screen or the volume of a sound etc. The purpose of using an easing function is often to ease the transition from one value to another. E.g., instead of instantly moving an element on the screen or instantly changing the volume of a sound you perform a short transition using the easing function to calculate the intermediate values.

So the duration of an easing function is how long it takes to move from the initial value to the final value, e.g. the time it takes to move the element across the screen or the time it takes to adjust the volume. Often this value is a fraction of a second to be perceptible without imposing an unecessary delay.

Here are some examples of easing functions (from How to create custom easing function with Core Animation?):

Easing functions

The horizontal axis is time and the duration is the time elapsed from the start of the easing function until it ends.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top