kbroulik / lottie-qml

QML Item for rendering Lottie Web animations in a QtQuick Canvas
71 stars 12 forks source link
animation-library bodymovin lottie lottie-web qml

Lottie QML

This provides a QML Item to render Adobe® After Effects™ animations exported as JSON with Bodymovin using the Lottie Web library.

See http://airbnb.io/lottie/

How to use

You can use the LottieAnimation item just like any other QtQuick element, such as an Image and place it in your scene any way you please.

import org.kde.lottie 1.0

LottieAnimation {
    id: fancyAnimation
    anchors.fill: parent
    source: Qt.resolvedUrl("animations/fancy_animation.json")
    loops: Animation.Infinite
    fillMode: Image.PreserveAspectFit
    running: true
}

There is a testing application provided in this repository:

qmlscene tester.qml

Just drag a Lottie JSON animation file into it and tweak the settings provided in the toolbar. You can also add multiple files and switch between them using the ComboBox in the top left or Ctrl+(Shift)+Tab shortcuts.

Property documentation

Notes

How to install

mkdir build
cd build
cmake ..
make
make install

Known issues

License

This library is licensed under either version 2.1 of the GNU Lesser General Public License, or (at your option) version 3, or any later version accepted by the membership of KDE e.V. (or its successor approved by the membership of KDE e.V.), see COPYING.LGPL-2.1, except for:

src/qml/3rdparty/lottie.min.js

The MIT License (MIT)

Copyright (c) 2015 Bodymovin

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.