diff --git a/src/core/Animators/staticcomplexanimator.cpp b/src/core/Animators/staticcomplexanimator.cpp index c0cb7e52e..8f69dd5b3 100644 --- a/src/core/Animators/staticcomplexanimator.cpp +++ b/src/core/Animators/staticcomplexanimator.cpp @@ -39,9 +39,13 @@ void StaticComplexAnimator::prp_readProperty_impl(eReadStream &src) { const auto& children = ca_getChildren(); const auto SVGProperties = QStringList() << "begin event" << "end event"; + const bool isSubPathEffect = prp_getName() == "sub-path effect"; + for (const auto& prop : children) { if (src.evFileVersion() < EvFormat::svgBeginEnd && SVGProperties.contains(prop->prp_getName())) { continue; } + if (src.evFileVersion() < EvFormat::subPathOffset && + isSubPathEffect && prop->prp_getName() == "offset") { continue; } prop->prp_readProperty(src); } } diff --git a/src/core/PathEffects/subpatheffect.cpp b/src/core/PathEffects/subpatheffect.cpp index c527b08dd..e4d281134 100644 --- a/src/core/PathEffects/subpatheffect.cpp +++ b/src/core/PathEffects/subpatheffect.cpp @@ -41,9 +41,14 @@ SubPathEffect::SubPathEffect() : mMax->setValueRange(-999, 999); mMax->setCurrentBaseValue(100); + mOffset = enve::make_shared("offset"); + mOffset->setValueRange(-999, 999); + mOffset->setCurrentBaseValue(0); + ca_addChild(mPathWise); ca_addChild(mMin); ca_addChild(mMax); + ca_addChild(mOffset); } class SubPathEffectCaller : public PathEffectCaller { @@ -121,7 +126,9 @@ void SubPathEffectCaller::apply(SkPath &path) { stdsptr SubPathEffect::getEffectCaller( const qreal relFrame, const qreal influence) const { const bool pathWise = mPathWise->getValue(); - const qreal minFrac = mMin->getEffectiveValue(relFrame)*0.01*influence; - const qreal maxFrac = mMax->getEffectiveValue(relFrame)*0.01*influence + 1 - influence; + const qreal offset = mOffset->getEffectiveValue(relFrame); + const qreal minFrac = (mMin->getEffectiveValue(relFrame) + offset) * 0.01 * influence; + const qreal maxFrac = (mMax->getEffectiveValue(relFrame) + offset) * 0.01 * influence + 1 - influence; + return enve::make_shared(pathWise, minFrac, maxFrac); } diff --git a/src/core/PathEffects/subpatheffect.h b/src/core/PathEffects/subpatheffect.h index cd5f529fa..5f9579fbb 100644 --- a/src/core/PathEffects/subpatheffect.h +++ b/src/core/PathEffects/subpatheffect.h @@ -38,6 +38,7 @@ class CORE_EXPORT SubPathEffect : public PathEffect { qsptr mPathWise; qsptr mMin; qsptr mMax; + qsptr mOffset; }; #endif // SUBPATHEFFECT_H diff --git a/src/core/ReadWrite/evformat.h b/src/core/ReadWrite/evformat.h index a3c4e54a6..6d584beaa 100644 --- a/src/core/ReadWrite/evformat.h +++ b/src/core/ReadWrite/evformat.h @@ -44,6 +44,7 @@ namespace EvFormat { svgBeginEnd = 29, formatOptions = 30, formatOptions2 = 31, + subPathOffset = 32, nextVersion };