Created
August 16, 2018 22:39
-
-
Save shshaw/938e760f3d26172f434aa6a3bd5b7b76 to your computer and use it in GitHub Desktop.
SplittingImage Palette
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="palette" data-cols="10" data-rows="10"></div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.clear(); | |
SplittingImage('.palette'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="https://unpkg.com/splitting-image/splitting-image.js"></script> | |
<script src="https://codepen.io/shshaw/pen/epmrgO"></script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.palette .split-cell{ | |
/* Generate the rainbow! */ | |
background: hsl( | |
calc( 360 * var(--col-index) / var(--col-total) ), | |
75%, | |
calc( 5% + (90% * (1 - var(--row-index) / var(--row-total))) ) | |
); | |
visibility: visible; /* The split-cell is hidden by default for background-image based SplittingImage uses */ | |
} | |
/* Hover Effect */ | |
.palette .split-cell { | |
transition: transform 0.2s cubic-bezier(.75,0,.15,1); | |
transition-property: transform, box-shadow; | |
box-shadow: 0 0em 0em transparent; | |
} | |
.palette .split-cell:hover { | |
transform: scale(1.25); | |
box-shadow: 0 1em 2em rgba(0,0,0,0.3); | |
z-index: 2; | |
} | |
/* //////////////////////////////////////// */ | |
.palette { | |
width: 100%; | |
height: 100%; | |
position: absolute; | |
top: 0; right: 0; bottom: 0; left: 0; | |
margin: auto; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link href="https://unpkg.com/splitting-image/splitting-image.css" rel="stylesheet" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment