Docs about the trig functions.

This commit is contained in:
Chris Eppstein 2010-11-12 15:41:46 -08:00
parent 463301e983
commit a618ff3509
3 changed files with 64 additions and 1 deletions

View File

@ -44,6 +44,9 @@ COMPASS CHANGELOG
* `cos($number)` - Takes the cosine of the number. * `cos($number)` - Takes the cosine of the number.
* `tan($number)` - Takes the tangent of the number. * `tan($number)` - Takes the tangent of the number.
* `pi()` - Returns the value of π. * `pi()` - Returns the value of π.
If you provide a number with units of `deg` then it will return a unitless number
after converting to radians. Otherwise, it assumes the number is a radian length measure
and passes the units along to the result.
### Rails ### Rails

View File

@ -22,6 +22,7 @@ layout: core
* [adjust-saturation()](/docs/reference/compass/helpers/colors/#adjust-saturation) * [adjust-saturation()](/docs/reference/compass/helpers/colors/#adjust-saturation)
* [append-selector()](/docs/reference/compass/helpers/selectors/#append-selector) * [append-selector()](/docs/reference/compass/helpers/selectors/#append-selector)
* [color-stops()](/docs/reference/compass/helpers/color-stops/) * [color-stops()](/docs/reference/compass/helpers/color-stops/)
* [cos()](/docs/reference/compass/helpers/trig/#cos)
* [elements-of-type()](/docs/reference/compass/helpers/display/) * [elements-of-type()](/docs/reference/compass/helpers/display/)
* [enumerate()](/docs/reference/compass/helpers/selectors/#enumerate) * [enumerate()](/docs/reference/compass/helpers/selectors/#enumerate)
* [font-files()](/docs/reference/compass/helpers/font-files/) * [font-files()](/docs/reference/compass/helpers/font-files/)
@ -33,7 +34,9 @@ layout: core
* [inline-font-files()](/docs/reference/compass/helpers/inline-data/#inline-font-files) * [inline-font-files()](/docs/reference/compass/helpers/inline-data/#inline-font-files)
* [inline-image()](/docs/reference/compass/helpers/inline-data/#inline-image) * [inline-image()](/docs/reference/compass/helpers/inline-data/#inline-image)
* [nest()](/docs/reference/compass/helpers/selectors/#nest) * [nest()](/docs/reference/compass/helpers/selectors/#nest)
* [pi()](/docs/reference/compass/helpers/trig/#pi)
* [sin()](/docs/reference/compass/helpers/trig/#sin)
* [stylesheet-url()](/docs/reference/compass/helpers/urls/#stylesheet-url) * [stylesheet-url()](/docs/reference/compass/helpers/urls/#stylesheet-url)
* [scale-lightness()](/docs/reference/compass/helpers/colors/#scale-lightness) * [scale-lightness()](/docs/reference/compass/helpers/colors/#scale-lightness)
* [scale-saturation()](/docs/reference/compass/helpers/colors/#scale-saturation) * [tan()](/docs/reference/compass/helpers/trig/#tan)

View File

@ -0,0 +1,57 @@
---
title: Compass Trigonometric Helpers
crumb: Trig
framework: compass
meta_description: Helper functions for working with angles.
layout: core
classnames:
- reference
- core
- helpers
---
%h1 Compass Trig Helpers
:markdown
Trigonometric functions can help you manage complex calculations involving angles.
Or maybe they can be used to create pretty pictures. Who knows?
#pi.helper
%h3
%a(href="#pi")
pi()
.details
%p
Returns the value of π.
#sin.helper
%h3
%a(href="#sin")
sin($number)
.details
%p
Takes the sine of a number. If the number is unitless or has a unit of <code>deg</code>
then it will return a unitless result. Degrees will first be converted to radians.
If the number is any other unit, the units will be passed thru to the result,
and the number will be treated as radians.
#cos.helper
%h3
%a(href="#cos")
cos($number)
.details
%p
Takes the cosine of a number. If the number is unitless or has a unit of <code>deg</code>
then it will return a unitless result. Degrees will first be converted to radians.
If the number is any other unit, the units will be passed thru to the result,
and the number will be treated as radians.
#tan.helper
%h3
%a(href="#tan")
tan($number)
.details
%p
Takes the tangent of a number. If the number is unitless or has a unit of <code>deg</code>
then it will return a unitless result. Degrees will first be converted to radians.
If the number is any other unit, the units will be passed thru to the result,
and the number will be treated as radians.