0.3.0-next-6241023 • Published 10 months ago

react-cardflee-anim v0.3.0-next-6241023

Weekly downloads
-
License
-
Repository
github
Last release
10 months ago

React CardFlee Animation

A smoothly animated 3d card component whose edges flee away from mouse pointer.

Written in typescript.

Demo

https://user-images.githubusercontent.com/53266261/122939164-0571e100-d391-11eb-9d2b-b07f32dfee19.mp4

Usage

import CardFlee from 'react-cardflee-anim'

<CardFlee image='/images/myimg.jpg' />

Props

PropDescriptionDefaultExample
heightHeight of card300height = "300"
widthWidth of card200width = "200"
idUnique id for each cardundefinedid = "1" or id={1}
imageImage srcundefinedimage = "/image.jpg"
sensitivity(int) a factor for sensitiveness of animation20sensitivity = {23}
bgcolorA Background color css value to provide instead/behind of image.blackbgcolor = "#43ffbb"
headA JSX elementundefinedhead = <myHead />
contentA JSX elementundefinedcontent = <myContent />

NOTE : You must provide the id attribute if there are multiple cards on the same page.

Detailed Example

import React from "react";
import CardFlee from "./CardFlee";
import ReactDOM from "react-dom";

const content1 = <React.Fragment><p>watch the movie now
    <br />Grab your Tickets <br /></p></React.Fragment>;

const content2 = <React.Fragment>
    <p>
        New Season Out Now
    </p>
</React.Fragment>


ReactDOM.render(
    <React.StrictMode>
            <CardFlee id='1' image='/joker.jpg' head={<h1>Joker</h1>} content={content1} sensitivity={23} />
            <CardFlee id='2' image='/flash.jpg' head={<h1>The Flash</h1>} content={content2} />
    </React.StrictMode>,
    document.getElementById('root')
);

}