1.0.9 • Published 3 years ago

@cutting-mat/animater v1.0.9

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

English | 中文

@cutting-mat/animater

npm license

Feature

  • \<animated> component matching animate. CSS Achieve entry and exit animation
  • The combination of \<animated-group> and \<animated> can easily realize animation arrangement
  • Support anonymous mode, controlled mode and grouping mode to meet a variety of animation needs
  • With VueRoter's beforerouteleave hook, the page departure animation can also be realized

Install

npm i @cutting-mat/animater -S

Use

import animater from '@cutting-mat/animater';
Vue.use(animater);

Anonymous Mode

The simplest way to apply, anonymous animation group elements enter the field in turn

<animated-group>
    <animated>
        Content 1
    </animated>
    <animated>
        Content 2
    </animated>
    <animated>
        Content 3
    </animated>
</animated-group>

Controlled Mode

Both \<animated> and \<animated-group> support v-mode / value to drive the entry and exit status through data

<animated-group v-modle="groupVisible">
    <animated>
        Content 1
    </animated>
    <animated>
        Content 2
    </animated>
    <animated>
        Content 3
    </animated>
</animated-group>

<animated v-modle="dialogVisible">
    a dialog
</animated>

Marshalling Mode

By naming \<animated-group> components, they are divided into multiple animation groups, and the instance method is used to control the switching of each animation group

<!-- group 1 -->
<animated-group name="group1" class="group1-part1">
    <animated>
        Content 1-1
    </animated>
    <animated>
        Content 1-2
    </animated>
    <animated>
        Content 1-3
    </animated>
</animated-group>

<animated-group name="group1" class="group1-part2">
    <animated>
        Content 1-4
    </animated>
    <animated>
        Content 1-5
    </animated>
    <animated>
        Content 1-6
    </animated>
</animated-group>

<!-- group 2 -->
<animated-group name="group2" class="group2-part1">
    <animated>
        Content 2-1
    </animated>
    <animated>
        Content 2-2
    </animated>
    <animated>
        Content 2-3
    </animated>
</animated-group>

<animated-group name="group2" class="group2-part2">
    <animated>
        Content 2-4
    </animated>
    <animated>
        Content 2-5
    </animated>
    <animated>
        Content 2-6
    </animated>
</animated-group>
// Using Vue instance methods in components
this.$AnimatedGroup.enter('group1')

\<AnimatedGroup> Props

PropsDescriptionTypeOptionalDefault
v-modle / valueEntry and exit status of animation groupBoolean----
nameAnimation group nameString----
enterClassApproach animation class of \<Animated> subcomponentStringAnimate.css'animate__zoomIn'
leaveClassExit animation class of \<Animated> subcomponentsStringAnimate.css'animate__zoomOut'
durationAnimation duration of \<Animated> subcomponents, unit: SNumber--0.5
delayEntry / exit time interval between \<Animated> subcomponents, unit: SNumber--0.3
groupDelayEntry / exit time interval between named animation groups, unit: SNumber--0.8

\<AnimatedGroup> Events

Event NameDescriptionCallback Arguments
changeEntry and exit status change eventCurrent entry and exit status: visibilityBoolean
groupEnterStartEntry animation start event--
groupEnterEndEntry animation end event--
groupLeaveStartExit animation start event--
groupLeaveEndExit animation end event--

\<Animated> Props

PropsDescriptionTypeOptionalDefault
v-modle / valueInbound and outbound status (invalid as a child of animatedgroup)Boolean----
enterClassApproach animation class (priority over parent component setting)StringAnimate.css'animate__fadeIn'
leaveClassExit animation class (priority over parent component setting)StringAnimate.css'animate__fadeOut'
durationAnimation duration, in S (priority over parent component setting)Number--0.5

\<Animated> Events

Event NameDescriptionCallback Arguments
changeEntry and exit status change eventCurrent entry and exit status: visibilityBoolean
enterStartEntry animation start event--
enterEndEntry animation end event--
leaveStartExit animation start event--
leaveEndExit animation end event--

Instance Methods

Method NameDescriptionArgumentsReturn
$AnimatedGroup.enterSpecify animation group approachAnimation group name: nameStringPromise
$AnimatedGroup.leaveFront desk animation team exitAnimation group name: nameString Not required, no parameters will close all animation groups currently being displayedPromise

Notice

  • When AnimatedGroup and Animated are used in combination, they must be direct superiors and subordinates
  • If AnimatedGroup is included in a single file component, the component must be loaded synchronously
1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago