Skip to content

Instantly share code, notes, and snippets.

@vishu17
Last active August 29, 2015 13:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vishu17/10623732 to your computer and use it in GitHub Desktop.
Save vishu17/10623732 to your computer and use it in GitHub Desktop.
A less mixin that can be used to calculate the (x, y) co-ordinates on a curve whose equation is known
// @baseX: co-ord on x to start plotting from and also the x interval between the points plotted
// @index: a natural number used to specify the co-ords to retrieve
// Returns the co-ordinates plotted on a curve defined by the equation used which
// is a parabola in the following example
.calculate-co-ords(@index: 1, @baseX: 0) {
@x: @baseX * @index;
// Following is the equation of the parabola we plot our co-ords on
@y: ceil(sqrt(19.2 * (@x - 4.8)));
height: ~"@{y}px";
left: ~"@{x}px";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment