Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(preset-wind): themable animation #318

Merged
merged 6 commits into from
Dec 26, 2021
Merged

Conversation

userquin
Copy link
Member

@userquin userquin commented Dec 24, 2021

This PR adds animation entry on Theme to allow add/modify animate stuff on preset-wind.

The keyframes entry with this PR should be plain string, maybe we can change it to support also object.

For example, configuring the animation from the linked issue:

export default defineConfig({
  theme: {
    animation: {
      keyframes: {
        wiggle: '{0%,100% {transform:rotate(-3deg)} 50% {transform:rotate(30deg)}}'
      },
      durations: {
        wiggle: '1s'
      },
      timingFns: {
        wiggle: 'ease-in-out'
      }
    }
  }
})

closes #315

@userquin userquin requested a review from antfu as a code owner December 24, 2021 11:40
@netlify
Copy link

netlify bot commented Dec 24, 2021

✔️ Deploy Preview for ecstatic-mestorf-2e8afd ready!

🔨 Explore the source changes: b27cc6f

🔍 Inspect the deploy log: https://app.netlify.com/sites/ecstatic-mestorf-2e8afd/deploys/61c7ea202e61fa00084f5c04

😎 Browse the preview: https://deploy-preview-318--ecstatic-mestorf-2e8afd.netlify.app/

@userquin userquin marked this pull request as draft December 25, 2021 11:30
@userquin
Copy link
Member Author

Adding keyframes as record...

@userquin
Copy link
Member Author

userquin commented Dec 25, 2021

Now we can also configure keyframes using object style:

export default defineConfig({
  theme: {
    animation: {
      keyframes: {
        wiggle2: {
          '0%,100%': {
            transform: 'rotate(-3deg)'
          },
          '50%': {
            transform: 'rotate(30deg)'
          }
        },
        // or
        wiggle: '{0%,100% {transform:rotate(-3deg)} 50% {transform:rotate(30deg)}}'
      },
      durations: {
        wiggle2: '1s',
        wiggle: '1s'
      },
      timingFns: {
        wiggle2: 'ease-in-out',
        wiggle: 'ease-in-out'
      }
    }
  }
})

@userquin userquin marked this pull request as ready for review December 25, 2021 12:11
@userquin userquin marked this pull request as draft December 25, 2021 12:42
@userquin
Copy link
Member Author

userquin commented Dec 25, 2021

fixing it... nothing to fix, the example above was wrong

@userquin userquin marked this pull request as ready for review December 25, 2021 12:50
@antfu antfu changed the title feat(preset-mini + preset-wind): add animate theme support feat(preset-wind): add animate theme support Dec 26, 2021
@antfu antfu changed the title feat(preset-wind): add animate theme support feat(preset-wind): themable animation Dec 26, 2021
@antfu antfu merged commit 69d9f2f into main Dec 26, 2021
@antfu antfu deleted the feat/add-animate-stuff-to-theme branch December 26, 2021 04:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

please,how to set keyframes in theme about unocss.config.js ?
2 participants