Skip to content

Commit

Permalink
Make ticks more accurate
Browse files Browse the repository at this point in the history
  • Loading branch information
yuanchuan committed Apr 5, 2024
1 parent 39453a7 commit 1269a49
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/generator/css.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import { utime, UTime } from '../uniforms.js';

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

const DELAY = new Date().setHours(0, 0, 0, 0) - Date.now();

function is_host_selector(s) {
return /^\:(host|doodle)/.test(s);
}
Expand Down Expand Up @@ -792,16 +794,16 @@ class Rules {
}

if (this.uniforms.time) {
let delay = new Date().setHours(0, 0, 0, 0) - Date.now();
this.styles.container += `
:host,.host {
animation:${utime.animation()},${UTime.animation(delay + 'ms')};
animation:${utime.animation()},${UTime.animation(DELAY + 'ms')};
}
`;
console.log('updat');
this.styles.keyframes += `
@keyframes ${utime['animation-name']} {
from {--${utime.name}:0}
to {--${utime.name}:${Math.round(utime.ticks/(1000/60))}}
to {--${utime.name}:${Math.trunc(utime.ticks/(1000/60))}}
}
@keyframes ${UTime['animation-name']} {
from {--${UTime.name}:0}
Expand Down

0 comments on commit 1269a49

Please sign in to comment.