@function border-image($pos, $offset, $height, $radius, $border-width, $bg-color) {
    @return conic-gradient($bg-color 0 0) fill 0 / (max($border-width, $pos - $offset) 0 max($border-width, 100% - $pos - $offset) $radius) / 0 $height 0 0;
}

@function clip-path($pos, $offset, $height, $border-width, $angle) {
    @return polygon(
        100% 0,
        0 0,
        0 100%,
        100% 100%,
        calc(100% - $border-width) min(100% - $border-width, $pos + $offset - $border-width * tan(45deg - $angle / 4)),
        calc(100% + $height - $border-width / sin($angle / 2)) $pos,
        calc(100% - $border-width) max($border-width, $pos - $offset + $border-width * tan(45deg - $angle / 4))
    );
}

@mixin mixin($pos, $radius, $height, $angle, $border-width, $bg-color) {
    $offset: $height * tan($angle / 2);

    clip-path: clip-path($pos, $offset, $height, $border-width, $angle);
    border-image: border-image($pos, $offset, $height, $radius, $border-width, $bg-color);
}
