API

css.keyframes

★★★★★ Frozen

どのスタイルからでも、ホバーからでも再生できる CSS アニメーション。

export type keyframes = <const T extends Keyframes>(rule: T) => string;
export const keyframes: keyframes;

keyframes()は @keyframesルールを定義し、その名前、ビルド時にインラインされたユニークなハッシュを返します。これは animationNameとして使用されます。

例

TypeScript
import * as css from '@plumeria/core'

const fadeIn = css.keyframes({
  from: {
    opacity: 0,
  },
  to: {
    opacity: 1,
  },
});

const styles = css.create({
  box: {
    animationName: fadeIn,
    animationDuration: '1s',
    animationTimingFunction: 'ease-in-out',
  },
});

使い方

アニメーションは、:hoverのような擬似クラスから開始できます。

const styles = css.create({
  card: {
    transition: 'transform 0.3s ease',
    ':hover': {
      animationName: fadeIn,
      animationDuration: '0.5s',
    },
  },
});
Edit on GitHub