rubberBanding
iOSのゴムのようなインタラクション?を実現する計算式 x = (1.0 - (1.0 / ((x * c / d) + 1.0))) * d
code:RubberBanding.swift
func rubberBanding(
offset: CGFloat,
distance: CGFloat = 670,
coefficient: CGFloat = 0.55
) -> CGFloat {
(1.0 - (1.0 / ((offset * coefficient / distance) + 1.0))) * distance
}
https://scrapbox.io/files/661f81769a2ba60024309bea.png