21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'motion-prime/sections/collection/collection_delegate.rb', line 21
def collectionView(table, cellForItemAtIndexPath: index)
cur_call_time = Time.now.to_f
cur_call_offset = table.contentOffset.y
if @prev_call_time
time_delta = cur_call_time - @prev_call_time
offset_delta = cur_call_offset - @prev_call_offset
@deceleration_speed = offset_delta/time_delta
end
@prev_call_time = cur_call_time
@prev_call_offset = cur_call_offset
collection_section.cell_for_index(index)
end
|