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

colorful_gif

v1.0.1

Published

> ## 这是一个可以把滤镜图片混合进 gif 的库,它会返回一个新的 gif dataURL

Downloads

9

Readme

This is a tool that can mix filter to gif, then create a new gif dataURL.

这是一个可以把滤镜图片混合进 gif 的库,它会返回一个新的 gif dataURL

Demo preview(access)

* The size of demo's gif-resource below is about 10.5MB, maybe load very slow. You can also access online-website, that's faster and can test effect whatever you want. Or git clone this project and run npm i && npm run start

* 演示的动图大小大约有10.5MB,可能加载的很慢。你还可以访问在线站点,它可以更快打开并且可以任意测试效果,或者git clone本项目然后运行npm i && npm run start

Demo GIF

Usage

support esm 、commonjs and umd

First

npm i colorful_gif

Second

method 1:

You just need pass gif url(such as https://xxx.gif) and filter url(such as https://yyy.png) to mixFilterToGIF function ( It is important to note that the url must allow cross-origin! ).

你只需要向 mixFilterToGIF 函数分别传 gif url 和 滤镜 url 就可以了(务必注意 url 必须允许跨域!)

import { mixFilterToGIF } from "colorful_gif";
// if in commonjs, use:
// const { mixFilterToGIF } = require("colorful_gif")
// if import from <script src="**/colorful_gif.min.js" />, use directly:
// window.ColorfulGif.mixFilterToGIF

mixFilterToGIF("xxx.gif", "yyy.png").then((newGIFDataURL) => {
  // this will output new gif dataURL
  console.log(newGIFDataURL);

  // you can use this url to do anything……
});

method 2:

Also you can pass HTMLImageElements to mixFilterToGIF function. Look at example below:

或者你可以给 mixFilterToGIF 函数传入 image 元素,请看下面的例子:

Assume you have a html file like this:

假设你有一个像下面这样的 HTML:

<img id="gif" src="https://xxx.gif" />

<img id="filter" src="https://xxx.png" />

<img id="result" src="" />

You can do this in JavaScript file:

你可以在 JavaScript 里面这样做:

import { mixFilterToGIF } from "colorful_gif";

mixFilterToGIF(
  document.querySelector("#gif"),
  document.querySelector("#filter")
).then((newGIFDataURL) => {
  // this will output new gif dataURL 这里将打印出一个新的gif dataURL
  console.log(newGIFDataURL);

  // give this url to an image element
  const resultImage = document.querySelector("#result");
  resultImage.src = newGIFDataURL;
});

In the end, the img element what's id is result will show a new gif with filter.

最终,idresultimg 元素会展示新的带有滤镜的 gif。