Skip to content

Commit

Permalink
fix(fix import): fix import for test file
Browse files Browse the repository at this point in the history
  • Loading branch information
karamalie committed Sep 28, 2021
1 parent ebf0239 commit c59c1ab
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/animation/animation.test.ts
Expand Up @@ -48,3 +48,8 @@ test('Get unique colors', async () => {
[205, 16, 16, 1],
]);
});

test('Get text layer', async () => {
const anim = await Animation.fromURL('https://assets10.lottiefiles.com/packages/lf20_8MANkV.json');
console.log(anim.textLayers);
});
13 changes: 13 additions & 0 deletions src/animation/animation.ts
Expand Up @@ -143,6 +143,19 @@ export class Animation {
return colors;
}

/*
* return all the text layers with layer name
*/

public get textLayers(): Record<string, any> {
const textLayers: parentLocatorInterface = {};
const layers = this.getLayersByType(LayerType.TEXT) as TextLayer[];
layers.forEach((layer, index) => {
textLayers[index + '.' + layer.name] = layer.textData.d.k[0].s.t;
});
return textLayers;
}

/*
* returns the names of all prents given a shape
*/
Expand Down

0 comments on commit c59c1ab

Please sign in to comment.