Jump to content
Search Community

Hittest only working on the first instance

njvan test
Moderator Tag

Go to solution Solved by OSUblake,

Recommended Posts

  • Solution

Hi njvan,

 

Calling hitTest like you are doing will only call it on the first .pad element and the first .note element. You would need to loop through each pad and each note to do it like you want. That's going to be a little wasteful, so it would be best to only check notes that are in the same track as the pad. To further optimize, you should only check notes that are active. Notice how I added an active class to the element right before it animates and remove it right after it animates.

 

If you need any help understanding what I did here, just let me know.

 

See the Pen wvPxwRE by GreenSock (@GreenSock) on CodePen

 

  • Like 2
  • Thanks 1
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...