0

I'm trying to replicate the filter section from the top part of this website: https://kimeracorp.eu/

It has a smooth animation when toggling filter options, and the content adjusts dynamically. I believe it's built using Nuxt.js or Vue.js.

How can I create a similar UI/UX in Next.js? Any tips on which libraries, transition techniques, or component structure to use?

Thanks in advance!

3
  • a website like this most likely designed a custom feature here based on the "chips" UI element with transition animations using an animation platform like Greensock. at least thats how i would do it. Commented Jun 2 at 13:07
  • I am now seeing you already tagged gsap in your question... godspeed! Commented Jun 2 at 13:26
  • 1
    You don't really need Nuxt or Next for that, just use vanilla JS with GSAP or even better, some vanilla CSS. Don't make things too complicated. Otherwise, depending on what you want to achieve precisely, there might be a tutorial for such a thing somewhere already. Start small and go incremental. :) Commented Jun 2 at 13:47

1 Answer 1

2

You can use GSAP's Flip Plugin:

https://gsap.com/docs/v3/Plugins/Flip/

This demo could help getting started:

https://codepen.io/GreenSock/pen/NWRxarv

function updateFilters() {
  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;

  // adjust the display property of each item ("none" for filtered ones, "inline-flex" for matching ones)
  items.forEach(item => item.style.display = matches.indexOf(item) === -1 ? "none" : "inline-flex");
 
    // animate from the previous state
    Flip.from(state, {
        duration: 0.7,
        scale: true,
        ease: "power1.inOut",
        stagger: 0.08,
    absolute: true,
    onEnter: elements => gsap.fromTo(elements, {opacity: 0, scale: 0}, {opacity: 1, scale: 1, duration: 1}),
    onLeave: elements => gsap.to(elements, {opacity: 0, scale: 0, duration: 1})
    });
  
  // Update the all checkbox:
  allCheckbox.checked = matches.length === items.length; 
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.