Support cubic beziers curve style for edges
See original GitHub issueIssue type
Feature request
Description of new feature
- Provide a new curve-style like
unbundled-cubic-bezier
. - Support following parameters:
control-points
. It should be 4-length tuple of floating between 0 and 1. Those would be same points as the ones used in https://cubic-bezier.com/#.75,0,.25,1.
Motivation for new feature
Provide nice hierarchical layouts like the following example (taken from d3 gallery):
This has been asked on stackoverflow
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Advanced CSS Animation Using cubic-bezier() - CSS-Tricks
Let's update the curve and use cubic-bezier(0,4,1,4) instead. ... (but CSS Houdini is limited to Chrome and Edge support at the moment).
Read more >how to use bezier curves in cytoscape.js - Stack Overflow
For quadratic bezier like in Cytoscape, the distance of the curve will be half ... a series of straight lines: http://js.cytoscape.org/#style/segments-edges.
Read more >How to use Bezier Curves for Sweet and Smooth Edges! (Clip ...
4 min lesson + 5 min. demo. Learn why the Bezier Curve tool is a huge timesaver when you need clean smooth shapes...
Read more ><easing-function> - CSS: Cascading Style Sheets | MDN
Cubic Bézier curves with the P1 or P2 ordinate outside the [0, 1] range can cause the value to go farther than the...
Read more >Bézier curve - Wikipedia
A Bézier curve is a parametric curve used in computer graphics and related fields. ... The basis functions on the range t in...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks @IfatChitin it helped a lot.
I did another codepen which simulates cubic beziers edge by using two quadratic bezier edges.
Here’s how i did for two points
P0
andP1
. The idea is to generate two symmetric quadratic bezier curves which are represented by center control pointsA
&B
. Those control points coordinates are found by solving beziers equation. In the relative coordinates where(x0, y0) = (0, 0)
&(x1, y1) = (1, 1)
, we have(xA, yA) = (0.25, 0)
&(xB, yB) = (0.75, 1)
.Cytoscape expects for the parameter
control-points-distances
the distance between the point P1 and the imaginary line between P0 & P2 as illustrated here. With simple geometry, we can compute this distanced
which is illustrated in the below figure.z = sqrt((x1-x0)**2 + (y1-y0)**2)
costheta = (x1-x0)/z
h=0.25*(y1-y0)
(thales theorem)d=h*costheta
Hope this helps other people.
Hi @gtnx, Here is an example of how we achieved these beautiful edges (with relative values in terms of distance between nodes) using the current API:
https://codepen.io/ifatchitin/pen/JjoopVK
Hope this helps 😃 Ifat