Toolkit for dealing with Telegram Stickers and Bodymovin/Lottie animations
- Import from CDN.
<script src="https://unpkg.com/@lottiefiles/[email protected]/dist/tgskit.js"></script>
- Import from local node_modules directory.
<script src="/node_modules/@lottiefiles/tgskit/dist/tgskit.js"></script>
- Install package using npm or yarn.
npm install --save @lottiefiles/tgskit
- Import package in your code.
import { TGSKit } from '@lottiefiles/tgskit';
const anim = new TGSKit();
anim.load('http://localhost:1234/bodymovin.json')
.then(() => {
const errors = anim.validate();
if (errors.length === 0) {
anim.download('sticker');
} else {
console.log('Given JSON does not meet requirements for a TGS:');
console.log(errors);
}
})
.catch(err => {
console.log('There was an error loading the src resource', err);
});
TGSKit class documentation is available in the /docs/ directory.