Linear animation to work with target index

Bugfix for linear animation so that it works with target index.