Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

enter-animation

Package Overview
Dependencies
Maintainers
2
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

enter-animation

进场动画js

  • 0.6.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-80%
Maintainers
2
Weekly downloads
 
Created
Source

##EnterAnimation进场动画

NPM version build status Test coverage gemnasium deps node version npm download

Feature

  • support ie10+,chrome,firefox,safari

install

enter-animation

用法

<<<<<<< HEAD
var EnterAnimation = require('enter-animation');
var React = require('react');
React.render(<EnterAnimation>
=======
<EnterAnimation>
>>>>>>> cb42e18b66b5110e16319cd8b507b1c46dffcf8b
  <div key='demo'>
    <div>依次进场</div>
    <div>依次进场</div>
    <div>依次进场</div>
    <div>依次进场</div>
<<<<<<< HEAD
  </div>,container)
=======
  </div>
>>>>>>> cb42e18b66b5110e16319cd8b507b1c46dffcf8b
</EnterAnimation>

api

动画默认right

EnterAnimation标签下:

参数类型详细
enterobject管理进场数据
leaveobject管理当前元素出场的数据,默认null,null继承上面所有标签的值
componentstringEnterAnimation替换的标签名
routeDirectionstringroute时需要
routeCallBackfunctionroute时需要

enter={} or leave={}

参数类型详细
typestring执行动画的内置参数,默认;right
styleobject/string同上,style的样式动画,type有值,此项无效, 默认null
durationnumber每个动画的时间;默认0.5
delaynumber整个区块的延时,默认为0;
同startAnimation的delay
reverseboolean是否倒放,从最后一个dom开始往上播放,默认false
easestring样式缓动;默认 cubic-bezier(0.165, 0.84, 0.44, 1);
intervalnumber递增延时值,默认0.1
callbackfunction动画完成后回调

子dom标签下:

一级标签key:

参数类型详细
keystring必需,控制进出场;

二级标签或再下级标签:

参数类型详细
keystring子节新增与去除必须,单进场可不用
enter-dataobject如下data值;
leave-dataobject如上,如果为null,则继承enter-data和data-enter的所有参数

注:如子节点有enter-data值,则只执行有enter-data的节点的动画; 如果标签上的enter-datatype||style,则执行EnterAnimation标签上的type||style;

EnterRouteGroup

控制route的进出场;

如:

var Page1 = React.createClass({
  render() {
    return
      <EnterAnimation {...this.props}>
      <h1>添加或删除时EnterChild才起效,进出场仍然是EnterAnimation的参数</h1>
      <p style={{background: "#fff000"}} enter-data={{type: 'left'}} key='1'><Link to="/page1">a link to page 2 </Link>我是页面2.</p>
      <p style={{background: "#fff000"}} enter-data={{type: 'left'}} key='2'><Link to="/page1">a link to page 2 </Link>我是页面2.</p>
      <p style={{background: "#fff000"}} enter-data={{type: 'left'}} key='3'><Link to="/page1">a link to page 2 </Link>我是页面2.</p>
      </EnterAnimation>
  }
});
<EnterAnimation.EnterRouteGroup>
   <Page1 key='demo'/>
</EnterAnimation.EnterRouteGroup>

具体看demo,routerAdd.html;

##startAnimation的动画参数(EnterAnimation.to);

页面进场动画的类,通过CSS来快速完成页面刷新后的动画进场或子块的动画进场;

用法


//js触发式:
var EnterAnimation=requre('enter-animation');
EnterAnimation.to(node,vars);

参数说明

参数类型详细
nodestring要执行动画的dom(class,id);必要;
varsobject动画参数
vars参数
参数类型详细
direction"enter"动画进场或出场样式,以enter``leave两值;默认为"enter"
datastring / object执行动画的参数,有object和string两种类型,下面详解;默认为null
duration0.5动画的时间;
delaynumber整个区块的延时,默认为0;
同startAnimation的delay
easecubic-bezier(0.165, 0.84, 0.44, 1);样式缓动;
interval递增延时值。默认0.1
hideenboolean在开始动画前隐藏掉html,默认为true;
reverseboolean是否倒放,从最后一个dom开始往上播放,默认false
onCompletefunction动画完成后回调

####data参数(string|object);

data={}
参数类型详细
enterobject进场的样式
leaveobject出场样式
directionstring动画进场或出场样式,以enter``leave两值;默认为"enter",有值覆盖vars参数的direction
enter={} or leave={}
参数类型详细
typestring内置动画样式:
left right top bottom scale scaleFrom scaleX scaleY;
styleobject / stringstyle样式,如transform: translateX(100px),每个样式必须以;结束;type有值此项无效
durationvars参数的duration动画的时间;有值覆盖vars参数的duration
easevars参数的ease样式缓动;有值覆盖vars参数的ease
delay0动画的延时;默认0,依照结构递增以上的interval
queueId0动画的线程,可为多线程

支持style直接添加动画;

为string时,自动遍历node下的子节点来执行data样式;

为object时,树状形dom结构,以({})为一档标签; <<<<<<< HEAD 如:

<div class='a'>
  <div class='b'></div>
  <div class='c'></div>
</div>

node用的是".a",做b,c的动画,那data为:{}为最外层div;

{////外层div
children:[//子下的两div
{type:"left"},
{type:"left"}
]
}

如果元素为多个时:

<div class='a'>
 <ul>
   <li></li>
   <li></li>
   <li></li>
 </ul>
</div>

处理每个li里的span的动画时,data为:


[
{type:'left'},
{type:'left'},
{type:'left'}
]

=======

cb42e18b66b5110e16319cd8b507b1c46dffcf8b

Keywords

FAQs

Package last updated on 12 Oct 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc