本文整理汇总了C++中SVGLengthList::length方法的典型用法代码示例。如果您正苦于以下问题:C++ SVGLengthList::length方法的具体用法?C++ SVGLengthList::length怎么用?C++ SVGLengthList::length使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SVGLengthList
的用法示例。
在下文中一共展示了SVGLengthList::length方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: calculateAnimatedValue
void SVGLengthList::calculateAnimatedValue(
SVGAnimationElement* animationElement,
float percentage,
unsigned repeatCount,
SVGPropertyBase* fromValue,
SVGPropertyBase* toValue,
SVGPropertyBase* toAtEndOfDurationValue,
SVGElement* contextElement) {
SVGLengthList* fromList = toSVGLengthList(fromValue);
SVGLengthList* toList = toSVGLengthList(toValue);
SVGLengthList* toAtEndOfDurationList =
toSVGLengthList(toAtEndOfDurationValue);
SVGLengthContext lengthContext(contextElement);
ASSERT(m_mode == SVGLength::lengthModeForAnimatedLengthAttribute(
animationElement->attributeName()));
size_t fromLengthListSize = fromList->length();
size_t toLengthListSize = toList->length();
size_t toAtEndOfDurationListSize = toAtEndOfDurationList->length();
if (!adjustFromToListValues(fromList, toList, percentage,
animationElement->getAnimationMode()))
return;
for (size_t i = 0; i < toLengthListSize; ++i) {
// TODO(shanmuga.m): Support calc for SVGLengthList animation
float animatedNumber = at(i)->value(lengthContext);
CSSPrimitiveValue::UnitType unitType =
toList->at(i)->typeWithCalcResolved();
float effectiveFrom = 0;
if (fromLengthListSize) {
if (percentage < 0.5)
unitType = fromList->at(i)->typeWithCalcResolved();
effectiveFrom = fromList->at(i)->value(lengthContext);
}
float effectiveTo = toList->at(i)->value(lengthContext);
float effectiveToAtEnd =
i < toAtEndOfDurationListSize
? toAtEndOfDurationList->at(i)->value(lengthContext)
: 0;
animationElement->animateAdditiveNumber(percentage, repeatCount,
effectiveFrom, effectiveTo,
effectiveToAtEnd, animatedNumber);
at(i)->setUnitType(unitType);
at(i)->setValue(animatedNumber, lengthContext);
}
}
示例2: add
void SVGLengthList::add(SVGPropertyBase* other, SVGElement* contextElement) {
SVGLengthList* otherList = toSVGLengthList(other);
if (length() != otherList->length())
return;
SVGLengthContext lengthContext(contextElement);
for (size_t i = 0; i < length(); ++i)
at(i)->setValue(
at(i)->value(lengthContext) + otherList->at(i)->value(lengthContext),
lengthContext);
}