Coder Social home page Coder Social logo

lewhunt / divz Goto Github PK

View Code? Open in Web Editor NEW
145.0 1.0 4.0 21.93 MB

A React component that lets you scroll, swipe & zoom through HTML content on the 3D z-axis. Try out the demos here: https://lewhunt.github.io/divz/

Home Page: https://lewhunt.github.io/divz/

License: MIT License

HTML 6.27% CSS 24.54% TypeScript 68.10% JavaScript 1.09%
3d carousel component gallery react slideshow zoom typescript swipe slider presentations ui-design ux-ui showcase deck css3 experimental scroll 3d-slider slides

divz's Introduction

Divz

Latest npm version MIT License Monthly npm downloads

A React UI component that lets you scroll, swipe & zoom through HTML elements on the 3D z-axis

https://lewhunt.github.io/divz/

Click above to try out the demos


Installation

npm install divz

Basic Usage

Import the component and render it in your app or page, wrapping it around your list of divs or other HTML elements:

import { Divz } from "divz";

function App() {
  return (
    <Divz>
      <div>1</div>
      <div>2</div>
      <div>3</div>
      <div>4</div>
    </Divz>
  );
}

https://lewhunt.github.io/divz


Advanced Usage

The demos illustrate how the component can be initialised with more props - along with images and videos inside the child divs - for a richer user experience. Demo 3 also uses a custom video component with preview images, which optimises load and plays only when the current item is active/selected.

<>
  <img className="background" src={`./demo2/${selectedIndex + 1}-bg.jpg`} />

  <Divz
    className="demo2"
    autoPlay={true}
    autoPlayDuration={5000}
    onIndexChange={(i) => setSelectedIndex(i)}
  >
    {demo2Images.map((imageUrl, index) => (
      <div key={index}>
        <img src={imageUrl} />
      </div>
    ))}
  </Divz>
</>

divz-demo3.mov

Why Divz?

Divz was created to quickly showcase portfolio work within a pseudo-3D environment, loosely inspired by Apple's Time Machine interface which allows the user to zoom through historical Finder windows:

https://en.wikipedia.org/wiki/Time_Machine_%28macOS%29

Apple's Time Machine was the inspiration for Divz


What Sets It Apart?

  • Simplified Integration: Divz is designed to be responsive and easy to use, acting as a straightforward wrapper around a list of divs or other HTML elements.
  • Diverse Applications: While the demos showcase its versatility as a carousel, slideshow, or gallery component, Divz opens the door to a range of other potential uses. Consider it an innovative, experimental method for navigating web content.
  • Broad Device Support: Divz accommodates various navigation modes, including touch for mobile devices, cursor/trackpad for desktop users, and arrow keys for TV devices.

How Does It Work?

Under the hood, Divz performs CSS3 transforms on the core component and the child HTML elements, set dynamically with React TypeScript. The component is packaged using Vite to allow npm library integration.


Props

Prop Description Default
autoPlay Set to true to autoplay a carousel sequence of any children div elements false
isAutoPlayLooped Set to true to enable the autoPlay sequence to endlessly loop true
autoPlayDuration Set the time interval in milliseconds for the autoPlay feature 6000
showPlayButton Set to true to display the autoPlay toggle button true
showNavButtons Set to true to display the up/down navigational buttons for cycling between div children true
showExpandButton Set to true to display the 'full-screen' expand button which is used to toggle the scale of div items true
showNavButtonsOnExpanded Set to true to display the navigational buttons when div items have been expanded false
isExpanded Set to true to toggle the scale of div items false
isDarkMode Set to true to set the buttons UI styling to dark mode false
isSnapEnabled Set to true to ensure the transform animation is snap-fixed to only move between the div items true
isScrollPageEnabled Set to true to override the preferred 'fullscreen' behaviour and enable page scrolling with scrollbar. However, page scrolling is not recommended as it may also trigger the Divz swipe interactions false
selectIndex Set the index number to force it to instantly jump to position of a div child item. By default it will instead zoom animate to the first item. null
className Insert additional classname values for overriding the component CSS styling null
onIndexChange Called when navigation occurs and the currently selected divz item has changed index
onPlaying Called when autoPlay sequence starts or stops

Credits

Sample media used in the demos are from various open source projects:

  • Demo 2 images are generated in Midjourney by Manoela Ilic (link)
  • Demo 3 images and video are from Pixabay (link)
  • Demo 4 images are generated in Midjourney by Manoela Ilic (link)

Support

I hope this has given a good intro to the component and you get some use out of it for your own projects!

💬 Fire over a comment if you have any feedback, requests or issues 🐛

⭐ Give it a star if you like the component or want to bookmark it 🙏

divz's People

Contributors

lewhunt avatar

Stargazers

tn-py avatar Michele Maietta avatar Abdelrahman Seada avatar Tín Phạm avatar Hung Vu avatar Yehezkiel Dio Sinolungan avatar Oscar Frias Viñals avatar Tyoma avatar Houssin mhamdi avatar  avatar Lakshay Choudhary avatar Cokawa Mahiro avatar Ben avatar CodeSacha avatar  avatar  avatar  avatar Bigo avatar César Chafloque S. avatar Guido Morabito avatar Carlos Gahel Pulido Cervantes avatar Andrei Surugiu avatar  avatar Shukur Huseynli avatar CryptoAdu avatar Aridany avatar Samuel Zúñiga  avatar  avatar Seol So avatar Rafael López Dorado avatar Lluís Masdeu avatar Rubén avatar Vlad Pavlovski avatar PBK Bin avatar  avatar Hao avatar Gabriel de Jesus avatar Chidera avatar Heri Roque Tello avatar Alan Douglas avatar Davi Pinheiro avatar Freddy Saldivia avatar Osvaldo Valentin avatar Eduardo Reyes Martínez avatar DavydQc avatar Marina Solange García avatar Ron avatar Mauricio Yair avatar  avatar Daniel Muñoz avatar  avatar David Rojo avatar Leandro Piazza avatar Nilson avatar Felix Icaza avatar Stevens Pineda avatar Mario CS avatar James Perez avatar Emanuel Romero avatar Franyer Verjel avatar Alexander avatar Iván Muiñas Higuera avatar Luis Emmanuel avatar Adam avatar Rohit avatar Gabriel avatar Gadiel Mondragon avatar DreDev avatar Nicolas Brown avatar Jose Sánchez avatar  avatar Wind avatar 余凡 avatar vincent avatar Mark Laszlo avatar Pratik Kataria avatar Piotr Dąbrowski avatar Stavros Melidoniotis avatar nebula100  avatar 真是刘皇叔 avatar Dhanush avatar Akash Patel avatar  avatar Saenyakorn Siangsanoh avatar Page Carbajal avatar Eleven Estudio avatar Eva Raymond avatar Lubomir Anastasov avatar David Gidwani avatar Alexey Volkov avatar Ankan avatar Eason avatar  avatar TwoPinkyNoBrain avatar Indrajit Chakrabarty avatar Thiago Freitas avatar Nathaly Riaño Bejarano avatar  avatar Mark Joshua Haynes avatar koji avatar

Watchers

 avatar

divz's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.