Trig-JS
Trig-JS copied to clipboard
[FEATURE] Css Variable without unit
I think it could be great if a can use --trig vlaues without % or px unit. For example for scroll dynamic opacity or scale.
The question is we need units at all? Because i can solve that with css too.
calc(var(--trig)*1px) or calc(var(--trig)*1%)
"reverse" can solve with css calc too calc(var(--trig)*-1px)
Sorry for the late reply. If the px or % is taken away then you can't directly use the trig var without calc.
so
transform:translateY(var(--trig));
would no longer work.
I'm doing opacity in the docs like this:
opacity: calc(var(--trig));
transition: opacity ease-out 0.3s;
I've not tried multiplication by percent or pixels but the other way around works:
transform:translateY(calc(var(--trig) * 2));
or
transform:translateY(calc(var(--trig-px) * 2));