1// Copyright (C) 2018 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#include "bmrepeater_p.h"
5
6BMRepeater::BMRepeater(const QJsonObject &definition, const QVersionNumber &version, BMBase *parent)
7{
8 setParent(parent);
9 m_transform.setParent(this);
10 construct(definition, version);
11}
12
13BMBase *BMRepeater::clone() const
14{
15 return new BMRepeater(*this);
16}
17
18void BMRepeater::construct(const QJsonObject &definition, const QVersionNumber &version)
19{
20 qCDebug(lcLottieQtBodymovinParser) << "BMRepeater::construct():" << m_name;
21
22 BMBase::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, version);
29
30 QJsonObject offset = definition.value(key: QLatin1String("o")).toObject();
31 offset = resolveExpression(definition: offset);
32 m_offset.construct(definition: offset, version);
33
34 m_transform.construct(definition: definition.value(key: QLatin1String("tr")).toObject(), version);
35}
36
37void BMRepeater::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 BMRepeater::render(LottieRenderer &renderer) const
46{
47 renderer.render(repeater: *this);
48}
49
50int BMRepeater::copies() const
51{
52 return m_copies.value();
53}
54
55qreal BMRepeater::offset() const
56{
57 return m_offset.value();
58}
59
60const BMRepeaterTransform &BMRepeater::transform() const
61{
62 return m_transform;
63}
64

source code of qtlottie/src/bodymovin/bmrepeater.cpp