regl-arc

1.0.0Ā ā€¢Ā PublicĀ ā€¢Ā Published

regl-arc

šŸ‘‘ šŸ¹ Draw circular arc with regl in the vertex shader

Install

npmĀ installĀ --saveĀ regl-arc

Usage

Draw a 2D circular arc given starting point p1, ending point p2, the center of the circle, the radius and a clockwise flag. Points (center, p1, p2) are expressed as an array of two numbers, i.e. [x, y] coordinates (see simplicial complex).

Parameters are passed as uniforms to the vertex shader.

An optional parameter could be passed to specify the length of the arc (default is 30).

importĀ createReglĀ fromĀ 'regl'
importĀ createArcĀ fromĀ 'regl-arc'
Ā 
constĀ reglĀ =Ā createRegl()
constĀ arcĀ =Ā createArc(regl)
Ā 
drawArc({
Ā Ā radius:Ā 0.1,
Ā Ā center:Ā c,
Ā Ā p1:Ā startingPoint,
Ā Ā p2:Ā endingPoint,
Ā Ā clockwise:Ā 1,
Ā Ā color:Ā [0,Ā 1,Ā 0],
})

There is an example you can run with budo:

budoĀ draw-arc.test.jsĀ --openĀ --liveĀ --Ā -tĀ es2020

License

MIT Ā© nkint <nootropic.kint@gmail.com>

Dependentsā€‚(0)

Package Sidebar

Install

npm i regl-arc

Weekly Downloads

3

Version

1.0.0

License

MIT

Last publish

Collaborators

  • nkint