Krita Source Code Documentation
Loading...
Searching...
No Matches
KisDynamicSensorTime.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2022 Dmitry Kazakov <dimula73@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
7
9
11#include <KisCurveOptionData.h>
12
13
14KisDynamicSensorTime::KisDynamicSensorTime(const KisSensorWithLengthData &data, std::optional<KisCubicCurve> curveOverride)
15 : KisDynamicSensor(TimeId, data, curveOverride)
16 , m_periodic(data.isPeriodic)
17 , m_length(data.length)
18{
19}
20
22{
23 if (pi.isHoveringMode()) return 1.0;
24
25 const qreal currentTime =
27 std::fmod(pi.currentTime(), m_length) :
28 qMin(pi.currentTime(), qreal(m_length));
29
30 return currentTime / qreal(m_length);
31}
qreal length(const QPointF &vec)
Definition Ellipse.cc:82
const KoID TimeId("time", ki18nc("Context: dynamic sensors", "Time"))
generate a number that increase with time
KisDynamicSensorTime(const KisSensorWithLengthData &data, std::optional< KisCubicCurve > curveOverride)
qreal value(const KisPaintInformation &pi) const override
qreal currentTime() const
Number of ms since the beginning of the stroke.