akshay9 / react-3d-cube-transition

3D cube transitions with highly customizable each side

Home Page:https://akshay9.github.io/react-3d-cube-transition/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

React 3D Cube Transition Component πŸ’»πŸ“±

A easy to use React component to create a Fullpage 3-Dimensional rotating cube website.

NPM JavaScript Style Guide

Features

  • βœ… Highly customisable through React props
  • βœ… GPU accelerated animations
  • βœ… Zero dependencies
  • βœ… Examples included
  • πŸ”¨ Lazy-loading cube sides (WIP)
  • πŸ”¨ Animation events Callbacks (WIP)

Install

npm install --save react-3d-cube-transition

or

yarn add react-3d-cube-transition

Usage

import React, { Component } from 'react'

import CubeTransition from 'react-3d-cube-transition'
import 'react-3d-cube-transition/dist/index.css'

class Example extends Component {
  render() {
    return <CubeTransition 
              topPage= { <FirstPage/> }
              rightPage={ <SecondPage/> }
              contentElevation={ 15 }
            />
  }
}

Checkout working example - Standalone Example folder

Live Demo: Demo

Demo

react-3d-cube-transition demo

Main Props

Attributes Type Default Description
className string null Add a className to the component container
face string front Sets the current cube side. Possible values: front, top, left, right, top, bottom
contentElevation number 0 Set the elevation of content for each side with respect to its background
animationDuration number 1000 Animation Duration in ms (Note: Actual duration of the animation would be animationDuration*1.5 ms )
frontPage node null Renders content on the front side of the cube
backPage node null Renders content on the back side of the cube
leftPage node null Renders content on the left side of the cube
rightPage node null Renders content on the right side of the cube
topPage node null Renders content on the top side of the cube
bottomPage node null Renders content on the bottom side of the cube
frontCSS object {background: #000;} Additional styles to be applied to the front side of the cube
backCSS object {background: #000;} Additional styles to be applied to the back side of the cube
leftCSS object {background: #000;} Additional styles to be applied to the left side of the cube
rightCSS object {background: #000;} Additional styles to be applied to the right side of the cube
topCSS object {background: #000;} Additional styles to be applied to the top side of the cube
bottomCSS object {background: #000;} Additional styles to be applied to the bottom side of the cube

Author

Akshay Naik

License

MIT Β© akshay9

About

3D cube transitions with highly customizable each side

https://akshay9.github.io/react-3d-cube-transition/


Languages

Language:CSS 43.6%Language:SCSS 35.1%Language:JavaScript 19.6%Language:HTML 1.8%