0.2.4 • Published 6 months ago

@bryce-loskie/frame v0.2.4

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

frame

Animation util for vue based on Motion One

NPM version

Get Started

pnpm i @bryce-loskie/frame

Usage

1. Framer component

<template>
  <Framer appear :variants="variants">
    <div v-if="isShow" i-carbon-windy-snow text-4xl inline-block />
  </Framer>
</template>

<script lang="ts" setup>
  import { Framer, defineVariants, spring } from '@bryce-loskie/frame'

  const variants = defineVariants({
    enter: {
      x: [-200, 0],
      scale: [1, 2],
      options: {
        easing: spring(),
      },
    },
    leave: {
      x: 200,
      opacity: 0.5,
      scale: 1,
    },
  })
</script>

2. useFrame hook

<template>
  <div ref="elRef" i-carbon-windy-snow text="4xl sky-500" inline-block />
  <button class="m-3 text-sm btn capitalize" @click="animation?.reverse()">
    reverse
  </button>
</template>

<script lang="ts" setup>
  import { useFrame, spring } from '@bryce-loskie/frame'

  const elRef = ref()
  const animation = useFrame(
    elRef,
    {
      x: [-200, 0],
      scale: [1, 2],
    },
    {
      easing: spring(),
    }
  )
</script>

3. directive

<template>
  <div v-frame="keyframes" i-carbon-windy-snow text="4xl sky-500" inline-block />
</template>

<script lang="ts" setup>
  import { defineDirective, defineFrame, spring } from '@bryce-loskie/frame'

  const vFrame = defineDirective()
  const keyframes = defineFrame({
    x: [-200, 0],
    scale: [1, 2],
  }, {
    easing: spring(),
  })
</script>

License

MIT License © 2022 guygubaby

TODO:

  • Add Transition component
  • Add useFrame hook
  • Add directive
  • Export animate,spring,stagger fn
0.2.4

6 months ago

0.2.1

1 year ago

0.2.3

1 year ago

0.2.0

1 year ago

0.1.8

2 years ago

0.1.7

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

0.0.2

2 years ago

0.0.1-beta

2 years ago