From a618ff3509c446b4a1a1a2ea41e382c61766cf1c Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Fri, 12 Nov 2010 15:41:46 -0800 Subject: [PATCH] Docs about the trig functions. --- doc-src/content/CHANGELOG.markdown | 3 + .../content/reference/compass/helpers.haml | 5 +- .../reference/compass/helpers/trig.haml | 57 +++++++++++++++++++ 3 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 doc-src/content/reference/compass/helpers/trig.haml diff --git a/doc-src/content/CHANGELOG.markdown b/doc-src/content/CHANGELOG.markdown index f5dbb112..c39cea10 100644 --- a/doc-src/content/CHANGELOG.markdown +++ b/doc-src/content/CHANGELOG.markdown @@ -44,6 +44,9 @@ COMPASS CHANGELOG * `cos($number)` - Takes the cosine of the number. * `tan($number)` - Takes the tangent of the number. * `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 diff --git a/doc-src/content/reference/compass/helpers.haml b/doc-src/content/reference/compass/helpers.haml index 13d8837a..fc08fb7f 100644 --- a/doc-src/content/reference/compass/helpers.haml +++ b/doc-src/content/reference/compass/helpers.haml @@ -22,6 +22,7 @@ layout: core * [adjust-saturation()](/docs/reference/compass/helpers/colors/#adjust-saturation) * [append-selector()](/docs/reference/compass/helpers/selectors/#append-selector) * [color-stops()](/docs/reference/compass/helpers/color-stops/) + * [cos()](/docs/reference/compass/helpers/trig/#cos) * [elements-of-type()](/docs/reference/compass/helpers/display/) * [enumerate()](/docs/reference/compass/helpers/selectors/#enumerate) * [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-image()](/docs/reference/compass/helpers/inline-data/#inline-image) * [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) * [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) diff --git a/doc-src/content/reference/compass/helpers/trig.haml b/doc-src/content/reference/compass/helpers/trig.haml new file mode 100644 index 00000000..cf1e5320 --- /dev/null +++ b/doc-src/content/reference/compass/helpers/trig.haml @@ -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 deg + 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 deg + 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 deg + 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.