StevenJPx2 / nugget

Democratize premium animations ✨
https://nugget.stevenjohn.co
MIT License
13 stars 1 forks source link

🚀 Simplify directives for animations #6

Closed StevenJPx2 closed 6 months ago

StevenJPx2 commented 6 months ago

Description

Currently this is how you would want to create a baked text-split animation to translate lines from the bottom:

<h1
  v-split-animate="{
    baked: true,
    options: {
      splitBy: 'lines',
      animationOptions: { translate: true },
    },
  }"
>
  Nuxt is so cool
</h1>

This is a lot to do just one thing. Code often gets longer and verbose.

Solution

Apply the settings to the directive name itself, for example:

<h1 v-text-animate-baked-lines="{ translate: true, opacity: 'out' }">
  Nuxt is so cool
</h1>

Furthermore, we can have multiple entry types for values:

<h1 v-text-animate-baked-lines="['translate', { opacity: 'out' }]">
  Nuxt is so cool
</h1>

Implementation details

StevenJPx2 commented 6 months ago

Closed with v1.0.0-beta.0.