title: How to get the current value of animation slider on Plotly Dash?
body: <p>I am new to Plotly and Dash. May I know how to get the current value of the animation slider?</p>
  <p>What I did here is clicking the button to find out the current value of animation slider. I tried to use 'fig.layout.sliders[0].active' but it always returns the same index, which is 0, even though the slider is at other value.
  For example, I would like to get the current value of the animation in the picture below, which is 1972 (index at 4). I thought 'fig.layout.sliders[0].active' would return 4 but it always returns 0(the starting index, 1952) .</p>
  <p>EDIT: Let me give a clearer scenario here.
  I clicked the Play button and the animation slider started to move from 1952 to 2007(as shown in the picture). I stopped the animation slide at '1972' with the label of 'year=1972'.
  Then, when I pressed the 'Click Me' Button, it should print '4' because 1972 is at index 4 of the animation_frame. However, it printed '0'. No matter at which year I stopped the animation slider, it would just print '0'
  <a href="https://i.stack.imgur.com/euqmk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/euqmk.png" alt="snapshot" /></a></p>
  <pre><code>import dash_core_components as dcc
  import dash_html_components as html
  
  from dash.dependencies import Input, Output
  import plotly.express as px
  
  df = px.data.gapminder()
  
  fig = px.bar(df, x=&quot;continent&quot;, y=&quot;pop&quot;, color=&quot;continent&quot;, animation_frame=&quot;year&quot;, animation_group=&quot;country&quot;, range_y=[0,4000000000])
  
  layout = html.Div([
      html.Label(id='test', children=[]),
      html.Button('Click me', id='btn'),
      dcc.Graph(id='my-map', figure=fig ),
  
  ])
  
  
  @app.callback(Output('test', 'children'),
                [Input(component_id='btn', component_property='n_clicks')])
  def testing(value):
      if value:
          print('can',fig.layout.sliders[0].active)
      return ['dummy']
  </code></pre>