Skip to content

Instantly share code, notes, and snippets.

@carolina-vallejo
Created July 29, 2019 20:28
Show Gist options
  • Save carolina-vallejo/b69722e8e116f8302b683e07b0af8f56 to your computer and use it in GitHub Desktop.
Save carolina-vallejo/b69722e8e116f8302b683e07b0af8f56 to your computer and use it in GitHub Desktop.
private transform(d) {
const x = (((d.x0 + d.x1) / 2) * 180) / Math.PI;
const y = ((d.y0 + d.y1) / 2) * this.radius;
return `rotate(${x - 90}) translate(${y},0) rotate(${x < 180 ? 0 : 180})`;
}
private position(d) {
const x = (((d.x0 + d.x1) / 2) * 180) / Math.PI;
const y = ((d.y0 + d.y1) / 2) * this.radius;
return `rotate(${x - 90}deg) translate(${this.radius}px,0px) rotate(${x < 180 ? 0 : 180}deg)`;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment