pow()

import SwiftUI

// easeInOutExp
func f(_ x: CGFloat) -> CGFloat {
    return 
        x == 0  ? 0 :
        x == 1  ? 1 :
        x < 0.5 ? pow(2, 20 * x - 10 - 1) :
        1 - pow(2, -20 * x + 10 - 1)
} 

f(0)
f(1)
f(0.5)
f(0.25)
f(0.75)

Last updated