2.4.7 • Published 4 years ago

rc-banner-anim-strict-mode v2.4.7

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

rc-banner-anim


React BannerAnim Component

NPM version build status Test coverage node version npm download

Browser Support

IEChromeFirefoxOperaSafari
IE 10+ ✔Chrome 31.0+ ✔Firefox 31.0+ ✔Opera 30.0+ ✔Safari 7.0+ ✔

Development

npm install
npm start

Example

http://localhost:8012/examples/

online example: http://react-component.github.io/banner-anim/

install

rc-banner-anim

Usage

var BannerAnim = require('rc-banner-anim');
var React = require('react');
const { Element } = BannerAnim;
const BgElement = Element.BgElement;
React.render(<BannerAnim>
  <Element key="a">
    <BGElement key="bg" style={{ background: 'url(img)' }}/>
    <TweenOne key='0'>test text</TweenOne>
  </Element>
  <Element key="b">
    <BGElement key="bg" style={{ background: 'url(img)' }}/>
    <TweenOne key='0'>test text</TweenOne>
  </Element>
</BannerAnim>, container);

API

BannerAnim

`ref` control jump: <BannerAnim ref={(c) => { this.banner = c; }}/>

prev: this.banner.prev();

next: this.banner.next();

jump: this.banner.slickGoTo(number); number from 0;
nametypedefaultdescription
typestring / arrayAll animTypeProvide across, vertical, acrossOverlay, verticalOverlay, (gridBar, grid) => duration is a single block of animation time, video bg no use
durationnumber450Single switch time.
delaynumber0switch delay.
easestringeaseInOutQuadeasing.
initShownumber0start show
arrowbooleantrueArrow is children, this is null and void. else is default arrow
thumbbooleantrue^
autoPlaybooleanfalseauto play
autoPlaySpeednumber5000auto play delay
autoPlayEffectbooleantrueauto play when mouse leave
onChangefunc-onChange(before or after, currentShowInt)
prefixClsstring-user class
childrenreact.component-Element(must), Arrow, Thumb
syncbooleanfalseElement the children and Element the same time animation
dragPlaybooleantruedrag play next or prev
componentstring'div'component tag

Element

children is TweenOne, animation type must from;

nametypedefaultdescription
leaveChildHidebooleanfalsechildren leave switch animation. Replace the hideProps.
syncbooleanfalsechildren and Element the same time animation
prefixClsstring-user class
followParallaxobjectnullfollow mouse anim
componentstring'div'component tag
componentPropsobjectnullcomponent is React.Element, component tag props, not add style

followParallax is object

nametypedefaultdescription
delaynumbernullopen followParallax delay
dataarraynullcontent: { key: string, value: number, type: array or string, bgPosition: string }; key: children key; value: animation interval value, example: value is 20 => left: -20, center: 0 , right: 20 ; type: style or x y, bgPosition: if type is backgroundPosition, this is bg default position, else is invalid.
easestringeaseOutQuadanimate ease. refer
minMovenumbernullease.easeInOutQuad(start, minMove, 1, end); The mouse to move once, the minimum point of moving graphics, a second to reach the position of the mouse.

Element.BgElement

nametypedefaultdescription
classNamestring-className
scrollParallaxobjectnull{ y: 100 }, from bottom to top of browser, element leave display area y is 100
videoResizebooleantruechildren is video, video follow window resize
componentstring'div'component tag
componentPropsobjectnullcomponent is React.Element, component tag props, not add style

Arrow

nametypedefaultdescription
arrowType'prev' | 'next'-arrow type
prefixClsstring-user class
componentstring / React.Elementdivcomponent tag
componentPropsobjectnullcomponent is React.Element, component tag props, not add style

Thumb

nametypedefaultdescription
childrenReact.Element-must
prefixClsstring-user class
componentstring / React.Elementdivcomponent tag
componentPropsobjectnullcomponent is React.Element, component tag props, not add style