Hey GSapers !! How are you ?!?
[EDIT] I can't put the example right away, it appears at the bottom
I'm deciphering this flip example :
https://codepen.io/GreenSock/pen/NWRxarv
Overall i get it, i could use it, no problem... But i'm curious about this piece of code inside the updateFilters() function :
const state = Flip.getState(items), // get the current state
classes = filters.filter(checkbox => checkbox.checked).map(checkbox => "." + checkbox.id),
matches = classes.length ? gsap.utils.toArray(classes.join(",")) : classes;
Here is the glitch : the "matches" const:
"classes", extract among the "filters" GSAP array, the checked box from which it extract the id attributes. So far so good.
"matches", when the ternary operator gets a truthy value, retrieves a GSAP array related to the "items" GSAP array?! What the hell is going on ?!?
When i console.log this stuff i get something like :
[<div class="item orange" data-flip-id="auto-2" style="display: inline-flex;"></div>,<div class="item orange" data-flip-id="auto-4" style="display: inline-flex;"></div>]
I can't connect how it relates to the "items" GSAP array, since there's no reference to it in the "matches" const line !
Thank you for reading !