Skip to content

Instantly share code, notes, and snippets.

@mvbattan
Created April 7, 2017 16:01
Show Gist options
  • Select an option

  • Save mvbattan/4def305854368b6216c642ad1e84e420 to your computer and use it in GitHub Desktop.

Select an option

Save mvbattan/4def305854368b6216c642ad1e84e420 to your computer and use it in GitHub Desktop.
createLine
export const createLine = (dist, angle, color, opacity, startingPoint) => {
return {
backgroundColor: color,
height: 4,
width: dist,
bottom: dist * Math.sin(angle) / 2 + startingPoint.y,
left: -dist * (1 - Math.cos(angle)) / 2 + startingPoint.x,
position: 'absolute',
opacity,
transform: [
{ rotate: `${(-1) * angle} rad` }
]
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment