Skip to content

Commit

Permalink
Enable uniform value debugging through content.
Browse files Browse the repository at this point in the history
  • Loading branch information
yuanchuan committed Mar 31, 2024
1 parent 79743bf commit 5a423a4
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/generator/css.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import calc from '../calc.js';
import seedrandom from '../lib/seedrandom.js';
import { utime } from '../uniforms.js';

import { cell_id, is_nil, get_value, lerp, unique_id, join, make_array, remove_empty_values } from '../utils/index.js';
import { cell_id, is_nil, get_value, lerp, unique_id, join, make_array, remove_empty_values, hash } from '../utils/index.js';

function is_host_selector(s) {
return /^\:(host|doodle)/.test(s);
Expand Down Expand Up @@ -465,6 +465,16 @@ class Rules {
if (!/["']|^none\s?$|^(var|counter|counters|attr|url)\(/.test(value)) {
value = `'${value}'`;
}
let reset = new Map();
value = value.replace(/var\(\-\-cssd\-u(time|mousex|mousey|width|height)\)/g, n => {
let name = 'c' + hash(n);
reset.set(name, `${name} calc(tan(atan2(${n},1)))`);
return `counter(${name})`;
});
return `
${reset.size ? `counter-reset:${Array.from(reset.values()).join(' ')};` : ''}
content:${value};
`;
}

if (prop === 'transition') {
Expand Down

0 comments on commit 5a423a4

Please sign in to comment.