@@ -7,6 +7,7 @@ type FrameMutations = {
7
7
height ?: number ;
8
8
opacity ?: number ;
9
9
strokes ?: Stroke [ ] ;
10
+ color ?: string ;
10
11
foreground ?: string ;
11
12
background ?: string ;
12
13
speed ?: number ;
@@ -23,6 +24,7 @@ export class Frame {
23
24
readonly height = 0 ,
24
25
readonly opacity = 1 ,
25
26
readonly strokes = [ ] as Stroke [ ] ,
27
+ readonly color = "" ,
26
28
readonly foreground = "" ,
27
29
readonly background = "" ,
28
30
readonly speed = 100 ,
@@ -34,14 +36,16 @@ export class Frame {
34
36
35
37
with ( properties : FrameMutations ) : Frame {
36
38
return new Frame (
37
- properties . position || this . position ,
38
- properties . facing !== undefined ? properties . facing : this . facing ,
39
- properties . height !== undefined ? properties . height : this . height ,
40
- properties . opacity !== undefined ? properties . opacity : this . opacity ,
41
- properties . strokes || this . strokes ,
42
- properties . foreground !== undefined ? properties . foreground : this . foreground ,
43
- properties . background !== undefined ? properties . background : this . background ,
44
- properties . speed !== undefined ? properties . speed : this . speed ) ;
39
+ properties . position ?? this . position ,
40
+ properties . facing ?? this . facing ,
41
+ properties . height ?? this . height ,
42
+ properties . opacity ?? this . opacity ,
43
+ properties . strokes ?? this . strokes ,
44
+ properties . color ?? this . color ,
45
+ properties . foreground ?? this . foreground ,
46
+ properties . background ?? this . background ,
47
+ properties . speed ?? this . speed ,
48
+ ) ;
45
49
}
46
50
}
47
51
@@ -51,7 +55,8 @@ export class Animation {
51
55
52
56
constructor (
53
57
readonly duration : number ,
54
- readonly update : ( delta : number , keyFrame : Frame ) => Frame ) { }
58
+ readonly update : ( delta : number , keyFrame : Frame ) => Frame ,
59
+ ) { }
55
60
56
61
get currentFrame ( ) : Frame {
57
62
return this . update ( this . elapsed / this . duration , this . keyFrame ) ;
0 commit comments