Last active
August 29, 2015 13:59
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @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