Skip to content

Commit b298a47

Browse files
author
rofrischmann
committed
initial function set
1 parent 6a78da9 commit b298a47

29 files changed

+184
-0
lines changed

modules/functions/hsl.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import isObject from '../utils/isObject'
2+
3+
export default function hsl(h, s, l) {
4+
const values = isObject(h) ? [ h.hue, h.saturation, h.lightness ] : [ h, s, l ]
5+
return 'hsl(' + values.join(',') + ')'
6+
}

modules/functions/hsla.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import isObject from '../utils/isObject'
2+
3+
export default function hsla(h, s, l, a) {
4+
const values = isObject(h) ? [ h.hue, h.saturation, h.lightness, h.alpha ] : [ h, s, l, a ]
5+
return 'hsla(' + values.join(',') + ')'
6+
}

modules/functions/matrix.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import isObject from '../utils/isObject'
2+
3+
export default function matrix(a, b, c, d, x, y) {
4+
const values = isObject(a) ? [ r.a, r.b, r.c, r.d, r.x, r.y ] : [ a, b, c, d, x, y ]
5+
return 'matrix(' + values.join(',') + ')'
6+
}

modules/functions/matrix3d.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import isObject from '../utils/isObject'
2+
3+
export default function matrix3d(a1, b1, c1, d1, a2, b2, c2, d2, a3, b3, c3, d3, a4, b4, c4, d4) {
4+
const values = isObject(a1) ? [ r.a1, r.b1, r.c1, r.d1, r.a2, r.b2, r.c2, r.d2, r.a3, r.b3, r.c3, r.d3, r.a4, r.b4, r.c4, r.d4 ] : [ a1, b1, c1, d1, a2, b2, c2, d2, a3, b3, c3, d3, a4, b4, c4, d4 ]
5+
return 'matrix3d(' + values.join(',') + ')'
6+
}

modules/functions/perspective.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default function perspective(p) {
2+
return 'perspective(' + p + ')'
3+
}

modules/functions/rgb.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import isObject from '../utils/isObject'
2+
3+
export default function rgb(r, g, b) {
4+
const values = isObject(r) ? [ r.red, r.green, r.blue ] : [ r, g, b ]
5+
return 'rgb(' + values.join(',') + ')'
6+
}

modules/functions/rgba.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import isObject from '../utils/isObject'
2+
3+
export default function rgba(r, g, b, a) {
4+
const values = isObject(r) ? [ r.red, r.green, r.blue, r.alpha ] : [ r, g, b, a ]
5+
return 'rgba(' + values.join(',') + ')'
6+
}

modules/functions/rotate.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import isObject from '../utils/isObject'
2+
3+
export default function rotate(x, y) {
4+
const values = isObject(x) ? [ r.x, r.y ] : [ x, y ]
5+
return 'rotate(' + values.join(',') + ')'
6+
}

modules/functions/rotate3d.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import isObject from '../utils/isObject'
2+
3+
export default function rotate3d(x, y, z) {
4+
const values = isObject(x) ? [ r.x, r.y, r.z ] : [ x, y, z ]
5+
return 'rotate3d(' + values.join(',') + ')'
6+
}

modules/functions/rotateX.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default function rotateX(x) {
2+
return 'rotateX(' + x + ')'
3+
}

0 commit comments

Comments
 (0)