0.1.7 • Published 6 months ago

omi-transition v0.1.7

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

omi-transition

Define transition animation for entering and leaving.

  • fade-enter-from: defines the start state of entering the transition
  • fade-enter-active: defines the state when the transition takes effect and is removed after the transition animation is completed
  • fade-enter-to: define the end state of entering the transition, and remove it after the transition animation is completed
  • fade-leave-from: define the start state of leaving the transition
  • fade-leave-active: defines the state when leaving the transition takes effect
  • fade-leave-to: define the end state of leaving the transition, and remove it after the transition animation is completed

Install

import 'omi-transition'

Usage

import { render, signal, tag, Component, h } from 'omi'
import 'omi-transition'

const show = signal(false)

@tag('transition-demo')
class TransitionDemo extends Component {
  static css = `
    .fade-leave-to,
    .fade-enter-from {
      opacity: 0;
      transform: translateX(15px);
    }

    .fade-leave-active,
    .fade-enter-active {
      transition: all 500ms ease-in;
    }`

  render() {
    return (
      <>
        <button onClick={() => show.value = !show.value}>toggle</button>
        <h4 show={show.value} o-transition={{ name: "fade" }} >OMI</h4>
      </>
    )
  }
}

render(<transition-demo />, document.body)

API

Options

interface TransitionOptions {
  name: string;
  delay?: number;
  beforeEnter?: () => void;
  enter?: () => void;
  afterEnter?: () => void;
  beforeLeave?: () => void;
  leave?: () => void;
  afterLeave?: () => void;
}
0.1.0

6 months ago

0.0.1

7 months ago

0.1.2

6 months ago

0.1.1

6 months ago

0.0.2

7 months ago

0.1.7

6 months ago

0.1.4

6 months ago

0.1.3

6 months ago

0.1.6

6 months ago

0.1.5

6 months ago

0.0.0

5 years ago