npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

wrc-css-transtion

v0.0.6

Published

> 移动端弹出层动画组件

Downloads

1

Readme

移动端弹出层动画组件

  • 支持自定义入场、离场组件动画
  • 默认提供几种入场动画

在线链接

查看链接

基于react-transition-group二次封装

查看链接

API

属性如下

| 参数 | 说明 | 类型 | 默认值 | | :-----| :----: | :----: | ----: | | classNames | 进场离场的动画名称 | String | wrc-default-slide-top | | children | 需要动画的组件 | React Element | 必须 | | duration | 动画时长 | Number/毫秒 | 400 | | unmountOnExit | 退出时移除dom | Boolean | true | | ...restProps | 其他参数 | | |

动画不够?

可以自行定义class动画,动画样式格式如下

// classNames对应的值就是wrc-default-slide-top,安装这样的格式写css即可

@animate-wrc-default: cubic-bezier(0.25, 0.8, 0.25, 1);

.wrc-default-slide-top-enter{
  opacity: 0;
  transform: translateY(100%);
}

.wrc-default-slide-top-enter-active {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 400ms, transform 400ms @animate-wrc-default;
}

.wrc-default-slide-top-enter-done {
  opacity: 1;
  transform: translateY(0);
}

.wrc-default-slide-top-exit {
  opacity: 1;
  transform: translateY(0);
}

.wrc-default-slide-top-exit-active {
  opacity: 0;
  transform: translateY(100%);
  transition: opacity 400ms, transform 400ms @animate-wrc-default;
}

.wrc-default-slide-top-exit-done {
  opacity: 0;
  transform: translateY(100%);
}

单选日历

示例代码

import React, { useState, useEffect } from 'react';
import CssTranstion from 'CssTranstion';

export default function () {
  const [show, setShow] = useState(false)
  const showAnimate = (bool) => {
    setShow(bool)
  }
  const demo1 = {
    position: `absolute`,
    top: `0`,
    left: `0`,
    width: `100%`,
    height: `100%`,
    backgroundColor: `rgba(0,0,0, 0.5)`,
    color: `#fff`,
    padding: `20px`
  }

  return (
    <React.Fragment>
      <button onClick={() => showAnimate(true)}>右边进入动画</button>
      <br/>
      <br/>
      <CssTranstion in={show} classNames={'wrc-default-slide-left'}>
        <div style={demo1}>
          <br/>
          我是内容
          <br/>
          <button onClick={() => showAnimate(false)}>关闭动画</button>
        </div>
      </CssTranstion>
    </React.Fragment>
  )
}