1// Copyright (C) 2018 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#include "qlottierepeater_p.h"
5
6QLottieRepeater::QLottieRepeater(const QJsonObject &definition, QLottieBase *parent)
7{
8 setParent(parent);
9 m_transform.setParent(this);
10 construct(definition);
11}
12
13QLottieBase *QLottieRepeater::clone() const
14{
15 return new QLottieRepeater(*this);
16}
17
18void QLottieRepeater::construct(const QJsonObject &definition)
19{
20 qCDebug(lcLottieQtLottieParser) << "QLottieRepeater::construct():" << m_name;
21
22 QLottieBase::parse(definition);
23 if (m_hidden)
24 return;
25
26 QJsonObject copies = definition.value(key: QLatin1String("c")).toObject();
27 copies = resolveExpression(definition: copies);
28 m_copies.construct(definition: copies);
29
30 QJsonObject offset = definition.value(key: QLatin1String("o")).toObject();
31 offset = resolveExpression(definition: offset);
32 m_offset.construct(definition: offset);
33
34 m_transform.construct(definition: definition.value(key: QLatin1String("tr")).toObject());
35}
36
37void QLottieRepeater::updateProperties(int frame)
38{
39 m_copies.update(frame);
40 m_offset.update(frame);
41 m_transform.setInstanceCount(m_copies.value());
42 m_transform.updateProperties(frame);
43}
44
45void QLottieRepeater::render(QLottieRenderer &renderer) const
46{
47 renderer.render(repeater: *this);
48}
49
50int QLottieRepeater::copies() const
51{
52 return m_copies.value();
53}
54
55qreal QLottieRepeater::offset() const
56{
57 return m_offset.value();
58}
59
60const QLottieRepeaterTransform &QLottieRepeater::transform() const
61{
62 return m_transform;
63}
64

source code of qtlottie/src/lottie/qlottierepeater.cpp