@@ -12,11 +12,11 @@ export type SourceData = any[];
1212/**
1313 * Keyframe objects, which can be accessed via the property method `property.key()`
1414 */
15- export class Key {
15+ export class Key < ValueType extends Value > {
1616 /**
1717 * The value of the keyframe
1818 */
19- readonly value : Value = "key value" ;
19+ readonly value : ValueType ;
2020 /**
2121 * The location of the keyframe in time
2222 */
@@ -25,6 +25,10 @@ export class Key {
2525 * The index of the keyframe, e.g. The `1`st keyframe on the property. Starts from 0.
2626 */
2727 readonly index : number = 1 ;
28+
29+ constructor ( keyValue : ValueType ) {
30+ this . value = keyValue ;
31+ }
2832}
2933
3034export class Project {
@@ -201,7 +205,7 @@ export type Value =
201205 | Color
202206 | PathValue ;
203207
204- class Property < PropertyValueType extends Value > {
208+ export class Property < PropertyValueType extends Value > {
205209 /**
206210 * The number of keyframes on the property
207211 */
@@ -214,15 +218,15 @@ class Property<PropertyValueType extends Value> {
214218 * @returns The keyframe at the specified index on the property
215219 * @param index The index of the keyframe to return (e.g. the `1`st keyframe)
216220 */
217- key ( index : number ) : Key {
218- return new Key ( ) ;
221+ key ( index : number ) : Key < PropertyValueType > {
222+ return new Key ( this . value ) ;
219223 }
220224 /**
221225 * @returns The marker that is nearest in time to `t`
222226 * @param t Time value to get the marker closest to
223227 */
224- nearestKey ( time : number ) : Key {
225- return new Key ( ) ;
228+ nearestKey ( time : number ) : Key < PropertyValueType > {
229+ return new Key ( this . value ) ;
226230 }
227231 /**
228232 * @returns The group of properties (`PropertyGroup` object) relative to the property of which the expression is written
0 commit comments