guidepilot/php-lottie
Composer 安装命令:
composer require guidepilot/php-lottie
包简介
A library to extract metadata from Lottie animation and dotLottie files
README 文档
README
The PHP Lottie library allows to simply extract basic metatdata out of Lottie animation files and dotLottie files, such as:
- width and height
- frame rate
- duration
Installation
Installing with composer:
$ composer require guidepilot/php-lottie
Usage
Simple usage with lottie animation
<?php use GuidePilot\PhpLottie\LottieAnimation; $lottieAnimation = new LottieAnimation(file_get_contents('animation.json')); echo "Size: {$lottieAnimation->getWidth()}x{$lottieAnimation->getHeight()}".PHP_EOL; echo "FrameRate: {$lottieAnimation->getFrameRate()}".PHP_EOL; echo "Duration: {$lottieAnimation->getDuration()} seconds".PHP_EOL;
Usage with a dotLottie file
<?php use GuidePilot\PhpLottie\DotLottieFile; $file = new DotLottieFile('animation.lottie'); foreach ($file->getAnimations() as $aAnimation) { echo "Animation Id: {$aAnimation->getId()}".PHP_EOL; echo "Size: {$aAnimation->getWidth()}x{$aAnimation->getHeight()}".PHP_EOL; echo "FrameRate: {$aAnimation->getFrameRate()}".PHP_EOL; echo "Duration: {$aAnimation->getDuration()} seconds".PHP_EOL; }
统计信息
- 总下载量: 890
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-09-13