Gathering detailed insights and metrics for @csstools/postcss-trigonometric-functions
Gathering detailed insights and metrics for @csstools/postcss-trigonometric-functions
Gathering detailed insights and metrics for @csstools/postcss-trigonometric-functions
Gathering detailed insights and metrics for @csstools/postcss-trigonometric-functions
PostCSS Tools and Plugins
npm install @csstools/postcss-trigonometric-functions
Typescript
Module System
Min. Node Version
Node Version
NPM Version
97.6
Supply Chain
92.4
Quality
84.5
Maintenance
100
Vulnerability
100
License
CSS (43.27%)
JavaScript (30.08%)
TypeScript (23.07%)
HTML (3%)
Nunjucks (0.48%)
Shell (0.1%)
Total Downloads
548,529,424
Last Day
492,296
Last Week
4,858,831
Last Month
18,914,983
Last Year
205,425,884
MIT-0 License
996 Stars
4,431 Commits
79 Forks
10 Watchers
5 Branches
132 Contributors
Updated on Aug 27, 2025
Latest Version
4.0.9
Package Id
@csstools/postcss-trigonometric-functions@4.0.9
Unpacked Size
9.31 kB
Size
3.31 kB
File Count
7
NPM Version
10.9.0
Node Version
22.12.0
Published on
May 27, 2025
Cumulative downloads
Total Downloads
Last Day
64%
492,296
Compared to previous day
Last Week
8.6%
4,858,831
Compared to previous week
Last Month
-1.6%
18,914,983
Compared to previous month
Last Year
15.1%
205,425,884
Compared to previous year
1
npm install @csstools/postcss-trigonometric-functions --save-dev
PostCSS Trigonometric Functions lets you use sin
, cos
, tan
, asin
, acos
, atan
and atan2
to be able to compute trigonometric relationships following the CSS Values 4 specification.
1.trigonometry { 2 line-height: sin(pi / 4); 3 line-height: cos(.125turn); 4 line-height: tan(50grad); 5 transform: rotate(asin(-1)); 6 transform: rotate(asin(sin(30deg + 1.0471967rad))); 7 transform: rotate(acos(-1)); 8 transform: rotate(acos(cos(0 / 2 + 1 - 1))); 9 transform: rotate(atan(infinity)); 10 transform: rotate(atan(e - 2.7182818284590452354)); 11 transform: rotate(atan2(-infinity,-infinity)); 12 transform: rotate(atan2(-infinity,infinity)); 13 transform: rotate(atan2(-infinity,infinity)); 14 transform: rotate(atan2(90, 15)); 15} 16 17/* becomes */ 18 19.trigonometry { 20 line-height: 0.70711; 21 line-height: 0.70711; 22 line-height: 1; 23 transform: rotate(-90deg); 24 transform: rotate(89.99995deg); 25 transform: rotate(180deg); 26 transform: rotate(0deg); 27 transform: rotate(90deg); 28 transform: rotate(0deg); 29 transform: rotate(-135deg); 30 transform: rotate(-45deg); 31 transform: rotate(-45deg); 32 transform: rotate(80.53768deg); 33}
Add PostCSS Trigonometric Functions to your project:
1npm install postcss @csstools/postcss-trigonometric-functions --save-dev
Use it as a PostCSS plugin:
1const postcss = require('postcss'); 2const postcssTrigonometricFunctions = require('@csstools/postcss-trigonometric-functions'); 3 4postcss([ 5 postcssTrigonometricFunctions(/* pluginOptions */) 6]).process(YOUR_CSS /*, processOptions */);
Given the dynamic nature of custom properties it's impossible to know what the variable value is, which means the plugin can't compute a final value for the stylesheet.
Because of that, any usage that contains a var
is skipped.
PostCSS Trigonometric Functions lets you use different special units that are within the spec and computed at run time to be able to calculate the result of the trigonometric function.
The following units are supported:
pi
: Computes to Math.PI
which is 3.141592653589793
e
: Computes to Math.E
which is 2.718281828459045
infinity
, -infinity
: Compute to Infinity
and -Infinity
respectively. Note that the usage is case insensitive so InFiNiTy
is a valid value.Some calculations (such as sin(-infinity)
) might return NaN
as per the spec. Given that NaN
can't be replaced with a value that's useful to CSS it is left as is, as the result will be effectively ignored by the browser.
The preserve
option determines whether the original notation
is preserved. By default, it is not preserved.
1postcssTrigonometricFunctions({ preserve: true })
1.trigonometry { 2 line-height: sin(pi / 4); 3 line-height: cos(.125turn); 4 line-height: tan(50grad); 5 transform: rotate(asin(-1)); 6 transform: rotate(asin(sin(30deg + 1.0471967rad))); 7 transform: rotate(acos(-1)); 8 transform: rotate(acos(cos(0 / 2 + 1 - 1))); 9 transform: rotate(atan(infinity)); 10 transform: rotate(atan(e - 2.7182818284590452354)); 11 transform: rotate(atan2(-infinity,-infinity)); 12 transform: rotate(atan2(-infinity,infinity)); 13 transform: rotate(atan2(-infinity,infinity)); 14 transform: rotate(atan2(90, 15)); 15} 16 17/* becomes */ 18 19.trigonometry { 20 line-height: 0.70711; 21 line-height: sin(pi / 4); 22 line-height: 0.70711; 23 line-height: cos(.125turn); 24 line-height: 1; 25 line-height: tan(50grad); 26 transform: rotate(-90deg); 27 transform: rotate(asin(-1)); 28 transform: rotate(89.99995deg); 29 transform: rotate(asin(sin(30deg + 1.0471967rad))); 30 transform: rotate(180deg); 31 transform: rotate(acos(-1)); 32 transform: rotate(0deg); 33 transform: rotate(acos(cos(0 / 2 + 1 - 1))); 34 transform: rotate(90deg); 35 transform: rotate(atan(infinity)); 36 transform: rotate(0deg); 37 transform: rotate(atan(e - 2.7182818284590452354)); 38 transform: rotate(-135deg); 39 transform: rotate(atan2(-infinity,-infinity)); 40 transform: rotate(-45deg); 41 transform: rotate(atan2(-infinity,infinity)); 42 transform: rotate(-45deg); 43 transform: rotate(atan2(-infinity,infinity)); 44 transform: rotate(80.53768deg); 45 transform: rotate(atan2(90, 15)); 46}
No vulnerabilities found.