def add_slider(figure, slider_scale):
    """Adds slider for animation"""
    figure['layout']['sliders'] = {'args': ['slider.value', {'duration': 
        400, 'ease': 'cubic-in-out'}], 'initialValue': min(slider_scale),
        'plotlycommand': 'animate', 'values': slider_scale, 'visible': True}
    sliders_dict = {'active': 0, 'yanchor': 'top', 'xanchor': 'left',
        'currentvalue': {'font': {'size': 20}, 'prefix': 'Year:', 'visible':
        True, 'xanchor': 'right'}, 'transition': {'duration': 300, 'easing':
        'cubic-in-out'}, 'pad': {'b': 10, 't': 50}, 'len': 0.9, 'x': 0.1,
        'y': 0, 'steps': []}
    return sliders_dict
