LottieFiles / lottie-react

lottie web player as a react component
https://lottiefiles.com
MIT License
720 stars 80 forks source link

Support for preserveAspectRatio #98

Closed elishaterada closed 2 years ago

elishaterada commented 2 years ago

Overview

The @lottiefiles/lottie-player supports the preserveAspectRatio property which is handy to cover the entire page with animation. I thought it'd be helpful if the property is also supported for the React version.

...

Motivation

What inspired this enhancement? What makes you think this should be included?

It would be great to be able to pass in preserveAspectRatio so I can use the React version of the library.

...

Labels

theashraf commented 2 years ago

Thanks @elishaterada for the suggestion, but i believe it's achievable as the Player component accepts rendererSettings prop which can be used to set the preserveAspectRatio as desired

https://github.com/LottieFiles/lottie-react/blob/master/src/Player.tsx#L78 https://github.com/airbnb/lottie-web/wiki/Renderer-Settings#preserveaspectratio

elishaterada commented 2 years ago

Confirmed, thanks. The type provided only specify "Object" so it was a bit unclear, but it works!