Use slider values to calculate traces

Hello, Iโ€™ve been working with plotly for like 2 weeks ago. Iโ€™m trying to create is an interactive plot where you can see any function and the slope of its derivative interactively changing as you move the slider.
I have done the plot in matplotlib and works awesome because it constructs the plots with the slider values and does not just display the created frames as plotly do.
**Here is a quick example made in matplotlib, as you can see if we go from left to right (positive) we have that the function is going up **
***Figure_1


But if we go from right to left the function should decrease, here my plotly graph fails because I donโ€™t know how to get the values from the slider and state a condition for it
Figure_2

Hope someone can help me, I really want to start using plotly for my blog.