I hereby claim:
- I am hellozimi on github.
- I am simons (https://keybase.io/simons) on keybase.
- I have a public key ASDAgkj3GsX1uHBk8nVPAeYm6V2fUQYcG0LFmcvCwK5KwAo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
package cursor | |
// Cursor is just a string for flexibility | |
type Cursor string | |
// NewCursor transforms v into json and base64 encodes the json | |
func NewCursor(v any) (*Cursor, error) { | |
b, err := json.Marshal(v) | |
if err != nil { | |
return nil, err |
// number of verticies | |
const precision = 64 | |
// radius in percent (where 50 = full circle) | |
const containerWidth = 40 | |
const borderWidth = 1 | |
const radius = borderWidth/containerWidth // 48.5 | |
const points = [...Array(precision)].map((_, i) => { | |
let a = -i/(precision-1)*Math.PI*2; | |
let x = Math.cos(a)*radius + 50; |