Skip to content

Commit d43d42b

Browse files
committed
refactor(scss): replace divide with multiply (#18)
1 parent 6af5ab8 commit d43d42b

File tree

8 files changed

+17
-17
lines changed

8 files changed

+17
-17
lines changed

sass/_dot-bricks.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66

77
$spacing: $dot-width + 6px;
8-
$top-pos: $spacing/2;
8+
$top-pos: $spacing * .5;
99
$left-pos: -9999px;
1010
$x1: -$left-pos - $top-pos;
1111
$x2: -$left-pos - $top-pos + $spacing;

sass/_dot-fire.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
$left-pos: -9999px;
88
$x1: -$left-pos;
99
$y1: -1.5 * $dot-spacing;
10-
$y2: -1.5 * $dot-spacing/4;
10+
$y2: -1.5 * $dot-spacing * .25;
1111
$y3: 1.5 * $dot-spacing;
1212

1313
.dot-fire {

sass/_dot-floating.scss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,15 @@ $d-min: 12px;
4141

4242
@keyframes dot-floating {
4343
0% {
44-
left: calc(-50% - #{$dot-width/2});
44+
left: calc(-50% - #{$dot-width * .5});
4545
}
4646

4747
75% {
48-
left: calc(50% + #{$d-max * 2 + $dot-width/2});
48+
left: calc(50% + #{$d-max * 2 + $dot-width * .5});
4949
}
5050

5151
100% {
52-
left: calc(50% + #{$d-max * 2 + $dot-width/2});
52+
left: calc(50% + #{$d-max * 2 + $dot-width * .5});
5353
}
5454
}
5555

sass/_dot-hourglass.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
$dot-color-hsl: hsl(0, 100%, 0%);
99

1010
$r: $dot-spacing;
11-
$origin-x: $dot-width/2;
12-
$origin-y: $dot-height/2 + $r;
11+
$origin-x: $dot-width * .5;
12+
$origin-y: $dot-height * .5 + $r;
1313

1414
.dot-hourglass {
1515
position: relative;

sass/_dot-revolution.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
@include dot($bg-color: $dot-before-color);
2424

25-
transform-origin: $dot-width/2 ($dot-spacing + $dot-width/2);
25+
transform-origin: ($dot-width * .5) ($dot-spacing + $dot-width * .5);
2626
animation: dot-revolution 1.4s linear infinite;
2727
}
2828

@@ -32,7 +32,7 @@
3232

3333
@include dot($bg-color: $dot-after-color);
3434

35-
transform-origin: $dot-width/2 ($dot-spacing * 2 + $dot-width/2);
35+
transform-origin: ($dot-width * .5) ($dot-spacing * 2 + $dot-width * .5);
3636
animation: dot-revolution 1s linear infinite;
3737
}
3838
}

sass/_dot-spin.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ $y1: $dot-spacing * 1.2;
99
$-x1: -$x1;
1010
$-y1: -$y1;
1111

12-
$x2: $x1/1.414;
13-
$y2: $y1/1.414;
12+
$x2: $x1 * .707107; // 1/√2
13+
$y2: $y1 * .707107; // 1/√2
1414
$-x2: -$x2;
1515
$-y2: -$y2;
1616

sass/_dot-windmill.scss

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ $origin-y: 5px + $r;
2525
}
2626

2727
&::before {
28-
left: -($r/2 * 1.732);
29-
top: $r + $r/2;
28+
left: -($r * .5 * 1.732508); // √3
29+
top: $r + $r * .5;
3030

3131
@include dot($bg-color: $dot-before-color);
3232
}
3333

3434
&::after {
35-
left: $r/2 * 1.732;
36-
top: $r + $r/2;
35+
left: $r * .5 * 1.732508; // √3
36+
top: $r + $r * .5;
3737

3838
@include dot($bg-color: $dot-after-color);
3939
}

sass/_variables.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44

55
$dot-width: 10px !default;
66
$dot-height: 10px !default;
7-
$dot-radius: $dot-width/2 !default;
7+
$dot-radius: $dot-width * .5 !default;
88

99
$dot-color: #9880ff !default;
1010
$dot-bg-color: $dot-color !default;
1111
$dot-before-color: $dot-color !default;
1212
$dot-after-color: $dot-color !default;
1313

14-
$dot-spacing: $dot-width + $dot-width/2 !default;
14+
$dot-spacing: $dot-width + $dot-width * .5 !default;

0 commit comments

Comments
 (0)