add animation function to lib and use it for sparkline