Skip to content

Instantly share code, notes, and snippets.

@andriyun
Created February 16, 2016 09:51
Show Gist options
  • Save andriyun/97107a601353c87cd1f7 to your computer and use it in GitHub Desktop.
Save andriyun/97107a601353c87cd1f7 to your computer and use it in GitHub Desktop.
@mixin resize-sprite($map, $sprite, $percent) {
$spritePath: 'generated/' + sprite-path($map);
$spriteWidth: image-width($spritePath);
$spriteHeight: image-height($spritePath);
$width: image-width(sprite-file($map, $sprite));
$height: image-height(sprite-file($map, $sprite));
@include background-size(ceil($spriteWidth * ($percent/100)) ceil($spriteHeight * ($percent/100)));
background-image: image_url($spritePath);
width: ceil($width*($percent/100));
height: ceil($height*($percent/100));
background-position: 0 floor(nth(sprite-position($map, $sprite), 2) * ($percent/100));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment