g4rfiEld Posted June 19 Share Posted June 19 Hi, there are already a lot of similar questions, but unfortunately I could not find the answer I needed The problem is that I can't stop the music animation when a button is pressed. If the user wanted to turn off the music, then when clicked the music animation should disappear and a line should appear, but that doesn't work, instead the music animation still plays even when turned off I studied this example, but it didn't work out very well for me: Here is my demo: https://stackblitz.com/edit/vitejs-vite-zocssu?file=src%2FApp.jsx Thanks for the help! Link to comment Share on other sites More sharing options...
Solution Cassie Posted June 19 Solution Share Posted June 19 Hi there! So if I were you I would store the timeline somewhere where you can access it in a click function, then use control methods to control the timeline Here's a simple example without React See the Pen GRaQwpZ?editors=1011 by GreenSock (@GreenSock) on CodePen This is a good demo showing this pattern in React - See the Pen eYWGeGe by GreenSock (@GreenSock) on CodePen And a section of the GSAP docs https://gsap.com/resources/react-basics/#creating-and-controlling-timelines 2 Link to comment Share on other sites More sharing options...
g4rfiEld Posted June 19 Author Share Posted June 19 1 hour ago, Cassie said: Всем привет! Итак, на вашем месте я бы сохранил временную шкалу где-нибудь, где вы можете получить к ней доступ с помощью функции щелчка, а затем использовал бы методы управления для управления временной шкалой. Вот простой пример без React Это хорошая демонстрация, показывающая этот шаблон в React. И раздел документации GSAP https://gsap.com/resources/react-basics/#creating-and-controlling-timelines . Thank you) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now