Skip to content

Commit

Permalink
Add error to prevent blurry sprite animations
Browse files Browse the repository at this point in the history
  • Loading branch information
JoannesJ committed Feb 11, 2019
1 parent 39ff63e commit 5755a22
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion assets/anim.scss
Original file line number Diff line number Diff line change
Expand Up @@ -298,14 +298,21 @@ $spritesDir : '../../emotes/emoticons-animated/';
$file-ext: '.png') {

$path: $spritesDir + $file-name + $file-ext;
$frame-width: $sprite-width / $frame-count;

@if $frame-width != round($frame-width) {
@error
"$sprite-width should be dividable by $frame-count to prevent blurry rendering
Error on sprite-animation \"#{$file-name}\"";
}

@keyframes #{$file-name}-anim {
0% { background-position: 0; }
100% { background-position: -#{$sprite-width}; }
}

.chat-emote-#{$file-name}{
width: $sprite-width / $frame-count;
width: $frame-width;
height: $sprite-height;
margin-top: -$sprite-height;
background: url($path) left center;
Expand Down

0 comments on commit 5755a22

Please sign in to comment.