1.0.0 • Published 2 years ago

ngx-flip-card v1.0.0

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

Ngx Flip Card

Angular component to animate a double-sided card.

Allows control over direction of rotation, speed of animation and easing function. Can be performed on click or by external event.

Easily stylable.

Also contains a component to animate a tilt effect on the card.

This library was generated with Angular CLI version 13.3.0.

Examples

Flip card on click

Tilt card and flip

Usage

Import the NgxFlipCardModule and add the ngx-flip-card to the html of your components. ngx-flip-card should have two children, one for the front side and another for the back side with specific directives.

<ngx-flip-card [easing]="'easeOut'" [animationDuration]="2000">
    <div card-front>
        <img src="assets/cc_front.png" alt="card front">
    </div>
    <div card-back>
        <img src="assets/cc_back.png" alt="card back">
    </div>
</ngx-flip-card>

To add the tilt, add the component ngx-tilt-card

<ngx-tilt-card>
    <ngx-flip-card [easing]="'easeOut'" [animationDuration]="2000">
        <div card-front>
            <img src="assets/cc_front.png" alt="card front">
        </div>
        <div card-back>
            <img src="assets/cc_back.png" alt="card back">
        </div>
    </ngx-flip-card>
</ngx-tilt-card>

API

Flip card

PropertyTypeDefaultDescription
isBackSidebooleanfalseSets the back side as the current position
isBackSideChangeEventEmitter booleanN/AEvent for when isBackSide changes
animatebooleantruePlay animation when turning
animationDurationnumber2500Animation duration in milliseconds
animationEndEventEmitterN/AFires when animation ends
TranslationZnumber2Depth of the card (during rotation) in pixels
easing'linear' | 'easeIn' | 'easeOut' | 'easeInOut''linear'Easing function
direction'horizontal' | 'vertical''horizontal'Direction of the rotation
flipOnClickbooleantrueShould the card rotate when clicked
flipCard()functionN/ACall this function to flip the card

Tilt card

PropertyTypeDefaultDescription
rotationDegreesXnumber5Maximum degrees of rotation in the X axis
rotationDegreesYnumber5Maximum degrees of rotation in the Y axis