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

@xfe-team/snowy

v0.0.3

Published

下雪动效

Downloads

1

Readme

@xfe-team/snowy

下雪动效

NPM JavaScript Style Guide

Demo

https://xfeteam.github.io/libs/@xfe-team/snowy/index.html

Install

npm install --save @xfe-team/snowy

Usage

import React, { Component } from 'react'

import MyComponent from '@xfe-team/snowy'

class Example extends Component {
  render () {
    return (
      <MyComponent />
    )
  }
}

API

Component.defaultProps = {
  getSnowyParent: window,
  flakeColor: '255,255,255',
  flakeCount: 200,
  flakeForceDistance: 100,
  computeFlakeSize: () => Math.random() * 3 + 2, // 加号后面的值,雪花大小,为基准值,数值越大雪花越大
  computeFlakeSpeed: () => Math.random() + 0.5, // 加号后面的值,雪花速度,为基准值,数值越大雪花速度越快
  computeFlakeOpacity: () => Math.random() * 0.5 + 0.3 // 加号后面的值,为基准值,范围0~1
};

Component.propsTypes = {
  /**
   * 获取下雪容器,
   * 默认: window, 即全屏下雪
   */
  getSnowyParent: oneOfType([func, object]),
  /**
   * 雪花颜色
   * 默认: rgba 中的 “255,255,255”
   */
  flakeColor: string,
  /**
   * 雪花数目
   * 当值为 number: 代表无论在什么分辨率都为该数量的雪花
   * 当值为 func 时: (area)=> number, 参数为面积,即当前雪花容器的面积,可以根据 area/系数 动态算入雪花值
   * 当值为 string 时, 有效值只可以是 high, low, medium, 这将代表雪花的密集程度将会是 密集(high),一般(medium),稀疏(low),这也是会动态根据当前容器面积动态计算
   * 默认: 200
   */
  flakeCount: oneOfType([func, number, oneOf(['high', 'low', 'medium'])]),
  /**
   * 雪花弹出“用力”距离
   * 在 PC 端时默认情况下为 mousemove 时弹开雪花
   * 在移动端时默认情况下为 touchmove 时弹开雪花
   * 默认: 100
   */
  flakeForceDistance: number,
  /**
   * 计算雪花每一片大小
   * 具体参考 defaultProps
   */
  computeFlakeSize: func,
  /**
   * 计算雪花飘落速读
   * 具体参考 defaultProps
   */
  computeFlakeSpeed: func,
  /**
   * 计算雪花渐变透明度
   * 具体参考 defaultProps
   */
  computeFlakeOpacity: func
};

ChangeLog

0.0.3 (2020-02-13)

  • fix: 修复 getSnowyParent props 设置为 window 时 canvas 宽高为 0 的 bug

0.0.1 (2020-02-13)

  • feat: init commit

来源

听说冬天和雪花更配哦: https://imjad.cn/archives/code/sounds-winter-and-snowflakes-are-more-compatible/

License

MIT © xfe-team