@symbo.ls/scratch 0.7.19 → 0.7.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@symbo.ls/scratch",
3
3
  "description": "Φ / CSS framework and methodology.",
4
4
  "author": "symbo.ls",
5
- "version": "0.7.19",
5
+ "version": "0.7.20",
6
6
  "files": [
7
7
  "src"
8
8
  ],
@@ -0,0 +1,3 @@
1
+ 'use strict'
2
+
3
+ export const ANIMATION = {}
@@ -16,5 +16,6 @@ export * from './timing'
16
16
  export * from './document'
17
17
  export * from './responsive'
18
18
  export * from './cases'
19
+ export * from './animation'
19
20
 
20
21
  export const RESET = {}
package/src/set.js CHANGED
@@ -38,7 +38,8 @@ export const SETTERS = {
38
38
  timing: setSameValue,
39
39
  icons: setSameValue,
40
40
  reset: setSameValue,
41
- unit: setSameValue
41
+ unit: setSameValue,
42
+ animation: setSameValue
42
43
  }
43
44
 
44
45
  /**
@@ -1,7 +1,7 @@
1
1
  'use strict'
2
2
 
3
3
  import { toDashCase } from '@symbo.ls/utils'
4
- import { UNIT } from '../defaultConfig'
4
+ import { SEQUENCE, SPACING, UNIT } from '../defaultConfig'
5
5
  import { CONFIG } from '../factory'
6
6
  import { isString } from './object'
7
7
 
@@ -82,6 +82,20 @@ export const generateSubSequence = (props, sequenceProps) => {
82
82
  })
83
83
  }
84
84
 
85
+ const switchSequenceOnNegative = (key, base, ratio) => {
86
+ const values = Object.values(SEQUENCE)
87
+ const index = values.indexOf(ratio)
88
+ const diffRatio = ratio / SPACING.ratio
89
+ const total = values[values.length - 1] - values[0]
90
+ const avg = total / 2
91
+ const diff = avg - ratio
92
+ const scale = total / ratio
93
+ const finalDiff = avg + avg / diffRatio
94
+
95
+ // if (key < 0) return base * Math.pow(avg, key)
96
+ return base * Math.pow(ratio, key)
97
+ }
98
+
85
99
  export const generateSequence = (sequenceProps) => {
86
100
  const { type, base, ratio, range, subSequence } = sequenceProps
87
101
  const n = Math.abs(range[0]) + Math.abs(range[1])
@@ -90,8 +104,8 @@ export const generateSequence = (sequenceProps) => {
90
104
  for (let i = 0; i <= n; i++) {
91
105
  const key = range[1] - i
92
106
  const letterKey = numToLetterMap[key]
93
- const value = base * Math.pow(ratio, key)
94
- const scaling = ~~(value / base * 1000) / 1000
107
+ const value = switchSequenceOnNegative(key, base, ratio)
108
+ const scaling = ~~(value / base * 100) / 100
95
109
  const variable = prefix + letterKey
96
110
 
97
111
  const props = {