Git Product home page Git Product logo

mantouf / yzhanweather Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mantoufan/yzhanweather

0.0 0.0 0.0 85.23 MB

Pure CSS animation for sakura, rain, snow, firefly and butterfly effects, high performance without affecting SEO. 纯 CSS 动画实现樱花、雨、雪、萤火虫和蝴蝶飞舞背景效果,高性能且不影响 SEO

Home Page: https://mantoufan.github.io/yzhanWeather/

License: MIT License

JavaScript 100.00%

yzhanweather's Introduction

yzhanWeather

npm npm bundle size npm GitHub license ie11
Pure CSS animation for sakura, rain, snow, firefly and butterfly effects, high performance without affecting SEO
纯 CSS 动画实现樱花、雨、雪、萤火虫和蝴蝶飞舞背景效果,高性能且不影响 SEO
1kB Series Lib Fully functional with gzip code 1kB and keep source code readable

Quick Start

Setup

Node.js

npm i yzhanweather
import YZhanWeather from 'yzhanweather'

Browser

<script src="https://cdn.jsdelivr.net/npm/yzhanweather@latest/docs/yzhanweather.min.js"></script>

Usage

const yzhanweather = new YZhanWeather()
yzhanweather.run('firefly') // Options: sakura | snow | firefly | rain | butterfly 
yzhanweather.run('firefly', {
  maxDuration: 10 // Default: 10s, this option can determine the speed of animations
})
yzhanweather.clear() // Stop and clear all animations
yzhanweather.destory() // Destory the instance and free up memory

Demo

Online Demo
Note: click the select on the left-top to change weather

GIF

sakura
snow
firefly
rain
butterfly

Performance comparsion

We use a page from madfan including a 720P video background, collect data when rendering 40 butterflies at the same time.

  • With Old Version
    Note: By GIF and JavaScript in old folder the result of old version

  • With Pure CSS Version the result of new version

No long tasks, almost negligible CPU and GPU usage

Config

All config including speed, num and css tpl are in conf.js under the src folder.
You could change it and then npm run build your own version.
You can set maxDuration to control the speed of animations without changing the conf.js

yzhanweather's People

Contributors

mantoufan avatar dependabot[bot] avatar yzwaa avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.