javascript - Are there any options for inverting a bezier curve? (cytoscape.js)
问题描述
I'm trying to shape my edges similarly to this:
static mock of desired edges/curves
I'm able to create "S" shaped curves, but i would like them to invert when going downwards from the root node (similarly to the picture). I haven't noticed anything in the docs that describes settings to do this.
I have a demo here: https://codesandbox.io/s/l5m6mnlqrz
What could also work is if I were able to smooth out the 90 degree curve with the "taxi" curve-style, although this doesn't seem possible.
Any suggestions appreciated. Thanks.
解决方案
使用单个贝塞尔曲线不可能创建所需的形式,因为中心范围应该是垂直的。但是两条共轭曲线可能会提供适当的结果。
对于 A 点(左侧)和 B 点(B 点低于还是高于 A 点并不重要):
第一条曲线有起点P0=(XA, YA)
和终点P3=((XA + XB)/2, ((YA + YB)/2)
第一个控制点必须与起点位于同一水平线,第二个控制点必须与终点位于同一垂直线
X1, Y1 = X0 + DX, Y0
X2, Y2 = X3, Y3 - DY
参数DX and DY
定义直角的舍入。尝试将它们设置为DX = (X3 - X0) / 3
和DY = (Y3 - X0) / 3
m 然后改变分母以获得所需的曲线形式
第二部分是带点的镜像曲线
(X3, Y3), (X3, Y3 + DY), (XB - DX, YB), (XB, YB)
推荐阅读
- regex - 如何使用 PowerShell/RegEx 查找所有空的 HTML 文件
tag?</h1> <div id="body"><p>I am using Powershell to search thousands of HTML files for files that contain empty <code><title></code> tags. These tags may appear in the files - phpspreadsheet - PhpSpreadsheet - 如何设置图表的系列选项是次要坐标
- php - 无法删除带有下拉链接的帖子
- r - 如何通过 R 与 Kerberos 密钥表连接 HIVE?
- collections - 在对复合 json 进行排序时,不能强制转换为 java.lang.Comparable
- excel - 无法在 Excel VBA 中用字符填充数组
- javascript - 在 Angular 中渲染基于时间的 Observables 而不会检测到压倒性的变化
- javascript - How to use a variable declared in super method of parent Class inside same metod of inherited Class
- sql - Msg 207 在 WHERE 子句中使用 CTE 的列无效
- python - 使用两个数据帧的值执行计算