File tree Expand file tree Collapse file tree 3 files changed +20
-8
lines changed Expand file tree Collapse file tree 3 files changed +20
-8
lines changed Original file line number Diff line number Diff line change @@ -563,6 +563,14 @@ const Expose = add_alias({
563
563
return calc_with ( `var(--${ utime . name } )` ) ;
564
564
} ,
565
565
566
+ ts ( ) {
567
+ return calc_with ( `calc(var(--${ utime . name } ) / 1000)` ) ;
568
+ } ,
569
+
570
+ TS ( ) {
571
+ return calc_with ( `calc(var(--${ UTime . name } ) / 1000)` ) ;
572
+ } ,
573
+
566
574
UT ( ) {
567
575
return calc_with ( `var(--${ UTime . name } )` ) ;
568
576
} ,
Original file line number Diff line number Diff line change @@ -250,7 +250,8 @@ class Rules {
250
250
251
251
check_uniforms ( name ) {
252
252
switch ( name ) {
253
- case 'ut' : case 'UT' : case 't' : case 'T' : this . uniforms . time = true ; break ;
253
+ case 'ut' : case 'UT' : case 't' : case 'T' : case 'ts' : case 'TS' :
254
+ this . uniforms . time = true ; break ;
254
255
case 'ux' : this . uniforms . mousex = true ; break ;
255
256
case 'uy' : this . uniforms . mousey = true ; break ;
256
257
case 'uw' : this . uniforms . width = true ; break ;
@@ -794,19 +795,21 @@ class Rules {
794
795
}
795
796
796
797
if ( this . uniforms . time ) {
798
+ let n = 'animation-name' ;
799
+ let t = utime . ticks ;
800
+ let un = utime . name ;
801
+ let Un = UTime . name ;
797
802
this . styles . container += `
798
803
:host,.host {
799
804
animation:${ utime . animation ( ) } ,${ UTime . animation ( DELAY + 'ms' ) } ;
800
805
}
801
806
` ;
802
807
this . styles . keyframes += `
803
- @keyframes ${ utime [ 'animation-name' ] } {
804
- from {--${ utime . name } :0}
805
- to {--${ utime . name } :${ Math . trunc ( utime . ticks / ( 1000 / 60 ) ) } }
808
+ @keyframes ${ utime [ n ] } {
809
+ from {--${ un } :0} to {--${ un } :${ t } }
806
810
}
807
- @keyframes ${ UTime [ 'animation-name' ] } {
808
- from {--${ UTime . name } :0}
809
- to {--${ UTime . name } :${ utime . ticks } }
811
+ @keyframes ${ UTime [ n ] } {
812
+ from {--${ Un } :0} to {--${ Un } :${ t } }
810
813
}
811
814
` ;
812
815
}
Original file line number Diff line number Diff line change 1
1
function create_time_uniform ( name ) {
2
2
let ticks = 1000 * 60 * 60 * 24 ; /* 24 hours in ms */
3
+ let steps = ticks / ( 1000 / 60 ) ;
3
4
let aname = `${ name } -animation` ;
4
5
return {
5
6
name, ticks,
6
7
'animation-name' : aname ,
7
- animation : ( delay = '0s' ) => `${ ticks } ms linear ${ delay } infinite ${ aname } `
8
+ animation : ( delay = '0s' ) => `${ ticks } ms steps( ${ steps } ) ${ delay } infinite ${ aname } `
8
9
}
9
10
}
10
11
You can’t perform that action at this time.
0 commit comments