gpt4 book ai didi

javascript - 拉斐尔-JS : Rect with one round corner

转载 作者:数据小太阳 更新时间:2023-10-29 03:58:36 26 4
gpt4 key购买 nike

paper.rect(0, 0, settings.width, settings.height, settings.radius);

创建一个带有圆 Angular 的漂亮矩形。是否可以创建一个只有一个圆 Angular 的矩形?

最佳答案

如果你使用 Raphael JS:

Raphael.fn.roundedRectangle = function (x, y, w, h, r1, r2, r3, r4){
var array = [];
array = array.concat(["M",x,r1+y, "Q",x,y, x+r1,y]); //A
array = array.concat(["L",x+w-r2,y, "Q",x+w,y, x+w,y+r2]); //B
array = array.concat(["L",x+w,y+h-r3, "Q",x+w,y+h, x+w-r3,y+h]); //C
array = array.concat(["L",x+r4,y+h, "Q",x,y+h, x,y+h-r4, "Z"]); //D

return this.path(array);
};

只有右上角圆 Angular 的矩形

var paper = Raphael("canvas", 840, 480);
paper.roundedRectangle(10, 10, 80, 80, 0, 20, 0, 0);

来源和在线示例:http://www.remy-mellet.com/blog/179-draw-rectangle-with-123-or-4-rounded-corner/

关于javascript - 拉斐尔-JS : Rect with one round corner,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3303772/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com