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

[duoyun-ui, gem] unified animation #108

Closed
mantou132 opened this issue Dec 23, 2023 · 2 comments
Closed

[duoyun-ui, gem] unified animation #108

mantou132 opened this issue Dec 23, 2023 · 2 comments

Comments

@mantou132
Copy link
Owner

mantou132 commented Dec 23, 2023

  • modal/drawer: js close, css open+close 。 滑入+渐显
  • wait: js open+close 。渐显

特殊动画

  • collapse: js
  • carousel: css
  • coach-mark: css
  • toast: css
  • loading: css

animations 模块应该能改序列化成 css 动画,以达到用 animation 统一处理 js 和 css 动画

@mantou132
Copy link
Owner Author

mantou132 commented Dec 23, 2023

序列化 js animation:

.animate {
  animation: ${convertToCSSAnimation};
}
.animate {
  animation: showMask 0.15s ease forwards;
  @keyframes showMask {
      from {
        opacity: 0;
      }
    }
}

只序列化 frames:

const animations = createCSSSheet({
  showMask: styled.keyframes(frames),
});

@mantou132 mantou132 changed the title [duoyun-ui] unified animation [duoyun-ui, gem] unified animation Dec 23, 2023
@mantou132
Copy link
Owner Author

type PropertyKeyframes = {
  [key in keyof CSSStyleDeclaration]?: string | string[] | number | null | (number | null)[];
};

declare global {
  interface PropertyIndexedKeyframes extends PropertyKeyframes {}
}

export const fadeIn: PropertyIndexedKeyframes = { opacity: [0, 1] };
export const fadeOut: PropertyIndexedKeyframes = { opacity: [1, 0] };

export function convertToCSSKeyframes(keyframes: Keyframe[] | PropertyIndexedKeyframes) {
  return '';
}

mantou132 added a commit that referenced this issue Dec 24, 2023
mantou132 added a commit that referenced this issue Dec 24, 2023
mantou132 added a commit that referenced this issue Dec 24, 2023
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

No branches or pull requests

1 participant