1.0.5 • Published 2 years ago

react-3d-cube-transition v1.0.5

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

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

Main Props

AttributesTypeDefaultDescription
classNamestringnullAdd a className to the component container
facestringfrontSets the current cube side. Possible values: front, top, left, right, top, bottom
contentElevationnumber0Set the elevation of content for each side with respect to its background
animationDurationnumber1000Animation Duration in ms (Note: Actual duration of the animation would be animationDuration*1.5 ms )
frontPagenodenullRenders content on the front side of the cube
backPagenodenullRenders content on the back side of the cube
leftPagenodenullRenders content on the left side of the cube
rightPagenodenullRenders content on the right side of the cube
topPagenodenullRenders content on the top side of the cube
bottomPagenodenullRenders content on the bottom side of the cube
frontCSSobject{background: #000;}Additional styles to be applied to the front side of the cube
backCSSobject{background: #000;}Additional styles to be applied to the back side of the cube
leftCSSobject{background: #000;}Additional styles to be applied to the left side of the cube
rightCSSobject{background: #000;}Additional styles to be applied to the right side of the cube
topCSSobject{background: #000;}Additional styles to be applied to the top side of the cube
bottomCSSobject{background: #000;}Additional styles to be applied to the bottom side of the cube
<!--lazyLoad (WIP)booleanfalseLazily load other cube side screens when user navigates to them
organicArrows (WIP)booleantrueWhen set to true show the organic arrow next and prev controls
fillParent (WIP)booleantrueWhen set to true the cube will fill the dimensions of the parent element. Usefull for using it in full-screen mode.
startupScreen (WIP)nodenullSet's the startup screen component to be shown before the first screen is loaded. It works like a pre-loading screen.
buttons (WIP)booleantrueShould render the default left and right navigation buttons.
buttonContentRight (WIP)nodenullAdd content as children of the right button.
buttonContentLeft (WIP)nodenullAdd content as children of the left button.
onFirstMount (WIP)functionnullCalled on componentDidMount passing the slider reference as an argument
onTransitionEnd (WIP)functionnullCalled on at the slider transition end event passing the slider reference as an argument
onTransitionStart (WIP)functionnullCalled on slider transition start passing the slider reference as an argument
onTransitionRequest (WIP)functionnullCalled when a user interacts with the slider navigation (arrows or bullets)-->

Author

Akshay Naik

  • Checkout my Full-Stack Web and Machine Learning Developer Website
  • Other open source projects @ Project Lab

License

MIT © akshay9