All Projects → dmotz → Hexaflip

dmotz / Hexaflip

Licence: mit
🧊 Visualizes arrays as cube interfaces

Programming Languages

javascript
184084 projects - #8 most used programming language
coffeescript
4710 projects

Projects that are alternatives of or similar to Hexaflip

Frontend Hard Mode Interview
《前端内参》,有关于JavaScript、编程范式、设计模式、软件开发的艺术等大前端范畴内的知识分享,旨在帮助前端工程师们夯实技术基础以通过一线互联网企业技术面试。
Stars: ✭ 2,338 (+1631.85%)
Mutual labels:  jquery
Oblog
An Auto Rendering 🔽 Blogging System Based on MarkDown & Vue.js | 自动渲染装载 MarkDown 内容的博客系统
Stars: ✭ 133 (-1.48%)
Mutual labels:  jquery
Webapiclientgen
Strongly Typed Client API Generators generate strongly typed client APIs in C# .NET and in TypeScript for jQuery and Angular 2+ from ASP.NET Web API and .NET Core Web API
Stars: ✭ 134 (-0.74%)
Mutual labels:  jquery
Jquery.serializejson
Serialize an HTML Form to a JavaScript Object, supporting nested attributes and arrays.
Stars: ✭ 1,648 (+1120.74%)
Mutual labels:  jquery
Litecart
LiteCart - Free Shopping Cart Platform - Built with PHP, jQuery HTML 5 and CSS 3
Stars: ✭ 132 (-2.22%)
Mutual labels:  jquery
Fe Blog Repository
♻️ 🚀我的前端学习笔记仓库✨
Stars: ✭ 133 (-1.48%)
Mutual labels:  jquery
Base App
An app to help jumpstart a new Rails 4 app. Features Ruby 2.0, PostgreSQL, jQuery, RSpec, Cucumber, user and admin system built with Devise, Facebook login.
Stars: ✭ 127 (-5.93%)
Mutual labels:  jquery
Vue Circle Progress
A Vue.js component to draw animated circular progress bars
Stars: ✭ 135 (+0%)
Mutual labels:  jquery
Chyrp Lite
An ultra-lightweight blogging engine, written in PHP.
Stars: ✭ 131 (-2.96%)
Mutual labels:  jquery
Makesen
响应式企业门户网站 jQuery/Bootstrap开发
Stars: ✭ 134 (-0.74%)
Mutual labels:  jquery
Jquery.fbmessenger
Fake Facebook Messenger interactions on an iPhone with a simple jQuery plugin!
Stars: ✭ 130 (-3.7%)
Mutual labels:  jquery
Keyboard
Virtual Keyboard using jQuery ~
Stars: ✭ 1,670 (+1137.04%)
Mutual labels:  jquery
Toastr
👀 toastr.js notifications for Laravel 5 and Lumen
Stars: ✭ 133 (-1.48%)
Mutual labels:  jquery
Jquery Syntax
jQuery.Syntax is a light-weight client-side syntax highlighter.
Stars: ✭ 129 (-4.44%)
Mutual labels:  jquery
Jquery Ui
The official jQuery user interface library.
Stars: ✭ 10,997 (+8045.93%)
Mutual labels:  jquery
Involt
Inject hardware interactions directly into HTML layout.
Stars: ✭ 128 (-5.19%)
Mutual labels:  jquery
Roothub
使用 SSM 和 MySQL 开发的论坛系统
Stars: ✭ 131 (-2.96%)
Mutual labels:  jquery
Slide And Swipe Menu
⚡️ A sliding swipe menu that works with touchSwipe library.
Stars: ✭ 135 (+0%)
Mutual labels:  jquery
Editor.md
The open source embeddable online markdown editor (component).
Stars: ✭ 11,741 (+8597.04%)
Mutual labels:  jquery
Ruoyi Oracle
(RuoYi)官方仓库 基于SpringBoot的权限管理系统 易读易懂、界面简洁美观。 核心技术采用Spring、MyBatis、Shiro没有任何其它重度依赖。直接运行即可用
Stars: ✭ 134 (-0.74%)
Mutual labels:  jquery

HexaFlip

HexaFlip

Transform arrays of any length into cubes with infinite sides.

Featuring touch/mouse interaction, getter/setter methods, zero dependencies, and jQuery support.

Dan Motzenbecker, MIT License

@dcmotz

Take a look at the Codrops article for a guide through the process and some demos.

Basic Usage

Create an instance by passing a DOM element and a key-value set of arrays:

var cubeSet = new HexaFlip(document.getElementById('my-el'),
    {
        prince: ['For You', 'Prince', 'Dirty Mind', 'Controversy', '1999', 'Around the World in a Day'],
        curtis: ['Curtis', 'Roots', 'Super Fly', 'Back to the World', 'Got to Find a Way', 'Sweet Exorcist']
    }
);

// you can also pass a selector string and HexaFlip will take the first matching element:
var firstDiv = new HexaFlip('div');

If a value is a URL, HexaFlip will set that side to the image it points to, preloading it automatically.

You can also pass objects as values with style and value keys for some meticulous customization of different sides. Make the former an object literal of CSS properties to customize the styling of that cube face.

var colorCube = new HexaFlip('#color-cube',
    {
        chromaSet: [
          {
              value: 'orange',
              style: {
                  backgroundColor: '#e67e22',
                  fontWeight: 100
              }
          },
          {
              value: 'teal',
              style: {
                  backgroundColor: '#1abc9c',
                  fontFamily: 'Futura'
              }
          },
          {
              value: 'yellow',
              style: {
                  backgroundColor: '#f1c40f',
                  textDecoration: 'underline'
              }
          }
        ]
    }
);

To enable horizontal rotation (like the photos above), pass it in the options:

var horizontalCube = new HexaFlip('#my-el2',
    {
        letters: ['α', 'β', 'γ', 'δ', 'ε', 'ζ', 'η', 'θ', 'ι', 'κ', 'λ', 'μ',
                  'ν', 'ξ', 'ο', 'π', 'ρ', 'σ', 'τ', 'υ', 'φ', 'χ', 'ψ', 'ω']
    },
    {
        horizontalFlip: true,
        size: 300
    }
);

To set and get the values of the cubes:

cubeSet.setValue({ prince: '1999', curtis: 'Roots' });
cubeSet.getValue();

To rotate the cubes to the next or previous sides:

cubeSet.flip();
cubeSet.flipBack();

Events

To add custom DOM events, simply pass a key value object called domEvents to the instance's options:

//...
    },
    {
        domEvents: {
            mouseover: function(e, face, cube) {
                face.style.backgroundColor = 'red';
            },
            mouseout: function(e, face, cube) {
                face.style.backgroundColor = 'blue';
            },
            click: function(e, face, cube) {
                console.log(face.innerHTML);
            }
        }
    }
);

Every callback is passed the event object, the face element that triggered the event, and the cube element the face belongs to. The callback is automatically bound to the HexaFlip instance so this works properly.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].