Skip to content

Instantly share code, notes, and snippets.

@una
Created November 13, 2015 17:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save una/8a24c4f559722c97a102 to your computer and use it in GitHub Desktop.
Save una/8a24c4f559722c97a102 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
<div class="tomatoes"></div>
// ----
// Sass (v3.4.14)
// Compass (v1.0.3)
// ----
@mixin three-dee($img, $dist: 5px, $deg: 5deg, $width: 100%, $height: 500px) {
z-index: 1;
width: $width;
height: $height;
position: relative;
transform: rotateY($deg);
perspective: $width;
background: url('#{$img}'), cyan;
background-blend-mode: lighten;
background-size: cover;
&:after {
content: '';
position: absolute;
display: block;
width: $width;
height: $height;
z-index: 2;
perspective: -$width;
margin-left: $dist;
transform: rotateY(-$deg/2);
background: url('#{$img}'), red;
background-blend-mode: lighten;
background-size: cover;
mix-blend-mode: darken;
}
}
.tomatoes {
@include three-dee('https://upload.wikimedia.org/wikipedia/commons/3/30/Rubik_cube.png', 5px, 10deg, 400px, 400px);
}
.tomatoes {
z-index: 1;
width: 400px;
height: 400px;
position: relative;
transform: rotateY(10deg);
perspective: 400px;
background: url("https://upload.wikimedia.org/wikipedia/commons/3/30/Rubik_cube.png"), cyan;
background-blend-mode: lighten;
background-size: cover;
}
.tomatoes:after {
content: '';
position: absolute;
display: block;
width: 400px;
height: 400px;
z-index: 2;
perspective: -400px;
margin-left: 5px;
transform: rotateY(-5deg);
background: url("https://upload.wikimedia.org/wikipedia/commons/3/30/Rubik_cube.png"), red;
background-blend-mode: lighten;
background-size: cover;
mix-blend-mode: darken;
}
<div class="tomatoes"></div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment