Skip to content

Instantly share code, notes, and snippets.

@sergiu-radu
Created February 20, 2017 21: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 sergiu-radu/3f7780dd4fa39c54c2198aa20da4080b to your computer and use it in GitHub Desktop.
Save sergiu-radu/3f7780dd4fa39c54c2198aa20da4080b to your computer and use it in GitHub Desktop.
Creative Dissection Puzzles with CSS and SVG
$figures: (
('pentagon', $pentagon-transform, '../img/face-1.jpg'),
('hexagon', $hexagon-transform, '../img/face-2.jpg'),
('octagon', $octagon-transform, '../img/face-3.jpg'),
);
@each $figure in $figures {
$name: nth($figure, 1);
$transform: nth($figure, 2);
$image: nth($figure, 3);
.clip-#{$name} .clip {
background-image: url('#{$image}');
@for $i from 1 through length($transform) {
&:nth-child(#{$i}) {
clip-path: url('../##{$name}-#{$i}');
transform: nth($transform, $i);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment