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 🙏

© 2026 – Pkg Stats / Ryan Hefner

ol-animate

v1.0.2

Published

一款openlayers的图层动画插件

Downloads

17

Readme

一款基于openlayers的图层动画插件

安装

npm installl ol-animate -S

引用

import LayerAnimate from 'ol-animate/layerAnimate'
import Animate from 'ol-animate/animate'

demo

import VectorLayer from 'ol/layer/Vector'
import { Fill } from 'ol/style'

const vectorLayer = new VectorLayer()
const attrObj = { width: 1 }
const fill = new Fill()

const animate1 = new Animate({
  attr: attrObj,
  attrName: 'width',
  end: 5,
  duration: 2000,
  times: 4,
  direction: 'alternate'
})

const animate2 = new Animate({
  attr: fill,
  attrName: 'color',
  isOl: true,
  init: '#fff',
  end: '#000',
  duration: 1500,
  delay: 2000,
  times: Infinity
})

new LayerAnimate({
  layer: vectorLayer,
  animates: [animate1, animate2]
})

animate1.play()
animate2.play()

Animate Attributes

|参数 |说明(表示必须) |类型| |:- | :- |:-| |attr |需要改变的属性对象 |object| |attrName |attr的属性名* |string| |isOl |true表示attr为ol对象,否则为普通对象 |boolean| |init |状态初始值,如果不写,则为定义attr时的值 |string/number| |end |状态结束值* |string/number| |duration |动画持续时间* |number| |delay |动画延迟时间 |number| |times |动画循环次数,默认为1,即不循环 |number| |direction |动画循环方式,alternate为交替循环,即动画执行完一次后init和end状态互换|string|

Animate Methods

|方法名 |说明(set方法只要被调用会立即停止当前动画) |参数类型| |:- |:- |:-| |setInit |重新定义初始状态 |string/number| |setEnd |重新定义结束状态 |string/number| |setDuration |重新定义持续时间 |number| |setDelay |重新定义延迟时间 |number| |setTimes |重新定义重复次数 |number| |setDirection|重新定义循环方式 |string| |play |动画开始执行,返回一个promise,then函数表示动画执行完成的回调|——| |pause |暂停动画 |——| |stop |停止动画,并使动画回到初始状态 |——|

LayerAnimate Attributes

|参数 |说明(表示必须)|类型| |:- |:- |:-| |layer |绑定的图层对象 |object| |animates |绑定的动画列表* |array|

LayerAnimate Methods

|方法名 |说明 |参数类型| |:- |:- |:-| |addAnimate |添加动画对象 |object| |play |绑定的动画列表一起执行|——| |pause |绑定的动画列表一起暂停|——| |stop |绑定的动画列表一起停止|——|