Convert less mixins to scss

119 Views Asked by At

Can anyone, please, convert less mixins to scss? This is mixins for ineresting practice for apple icons style borders.

.border-squircle(@radius-x; @radius-y) {
   .loop(@radius-x; @radius-y; 359; 100% 0);
}

.loop(@radius-x; @radius-y; @counter; @list) when (@counter >= 0) {
    @cos-x: cos(unit(@counter, deg));
    @x: pow(abs(@cos-x), unit(@radius-x) / 100) * 50 * abs(@cos-x + 0.0000000001) / (@cos-x 
   + 0.0000000001) + 50;

   @sin-y: sin(unit(@counter, deg));
   @y: pow(abs(@sin-y), unit(@radius-y) / 100) * 50 * abs(@sin-y + 0.0000000001) / (@sin-y + 
   0.0000000001) + 50;

   @percent-x: percentage(round(@x, 1) / 100);
   @percent-y: percentage(round(@y, 1) / 100);

   @new-list: @percent-x @percent-y, @list;
   .loop(@radius-x; @radius-y; (@counter - 1); @new-list);
}

.loop(@radius-x; @radius-y; @counter; @list) when (@counter < 0) {
    clip-path: polygon(@list);
}

Thank you in advance!

Update:

Here is my implementation, but it doesn't work much wrong. At the output, I always get the coordinates for the rhombus.

https://jsfiddle.net/zncsLm5k/

Expected result: https://medium.com/@zubryjs/squircles-bringing-ios-7s-solution-to-rounded-rectangles-to-css-9fc35779aa65

0

There are 0 best solutions below