1
0
Fork 0
mirror of https://github.com/GuerillaStudio/now-playing synced 2024-11-09 22:51:52 +00:00
now-playing/assets/scss/1-core/_00-mixins.scss

65 lines
1.6 KiB
SCSS
Raw Normal View History

2019-11-27 17:06:26 +00:00
// --------------------------------------------------------------
// == mixins */
// --------------------------------------------------------------
@mixin flow($font-size, $bf: $base-font, $lh: $line-height) {
$lh-value: $base-font * $lh;
$coeff: ceil($font-size / $lh-value);
$new-lh: ($lh-value / $font-size) * $coeff;
$margin-bottom: $new-lh / $coeff;
margin-bottom: $margin-bottom + em;
font-size: $font-size / 10 + rem;
line-height: $new-lh;
}
/* Glitch
-------------------------------------------------------------- */
@mixin textGlitch($name, $intensity, $background, $highlightColor1, $highlightColor2, $width, $height) {
position: relative;
$steps: $intensity;
// Ensure the @keyframes are generated at the root level
@at-root {
// We need two different ones
@for $i from 1 through 2 {
@keyframes #{$name}-anim-#{$i} {
@for $i from 0 through $steps {
#{percentage($i*(1/$steps)) - 60} {
clip: rect(
random($height)+px,
$width+px,
random($height)+px,
0
);
}
}
}
}
}
&:before,
&:after {
content: attr(data-text);
position: absolute;
top: 0;
left: 0;
width: 100%;
background: $background;
clip: rect(0, 0, 0, 0);
}
&:after {
left: 2px;
text-shadow: -1px 0 $highlightColor1;
animation: #{$name}-anim-1 2s infinite linear alternate-reverse;
}
&:before {
left: -2px;
text-shadow: 2px 0 $highlightColor2;
animation: #{$name}-anim-2 3s infinite linear alternate-reverse;
}
}