Beispiel #1
0
FloatPoint SVGPathBlender::BlendState::blendAnimatedFloatPoint(
    const FloatPoint& fromPoint,
    const FloatPoint& toPoint) {
  if (m_typesAreEqual)
    return blendAnimatedFloatPointSameCoordinates(fromPoint, toPoint);

  // Transform toPoint to the coordinate mode of fromPoint
  FloatPoint animatedPoint = toPoint;
  if (m_fromIsAbsolute)
    animatedPoint += m_toCurrentPoint;
  else
    animatedPoint.move(-m_toCurrentPoint.x(), -m_toCurrentPoint.y());

  animatedPoint = blendFloatPoint(fromPoint, animatedPoint, m_progress);

  // If we're in the first half of the animation, we should use the type of the
  // from segment.
  if (m_isInFirstHalfOfAnimation)
    return animatedPoint;

  // Transform the animated point to the coordinate mode, needed for the current
  // progress.
  FloatPoint currentPoint =
      blendFloatPoint(m_fromCurrentPoint, m_toCurrentPoint, m_progress);
  if (!m_fromIsAbsolute)
    return animatedPoint + currentPoint;

  animatedPoint.move(-currentPoint.x(), -currentPoint.y());
  return animatedPoint;
}
Beispiel #2
0
FloatPoint SVGPathBlender::blendAnimatedFloatPoint(const FloatPoint& fromPoint, const FloatPoint& toPoint)
{
    if (m_fromMode == m_toMode)
        return blendFloatPoint(fromPoint, toPoint, m_progress);

    // Transform toPoint to the coordinate mode of fromPoint
    FloatPoint animatedPoint = toPoint;
    if (m_fromMode == AbsoluteCoordinates)
        animatedPoint += m_toCurrentPoint;
    else
        animatedPoint.move(-m_toCurrentPoint.x(), -m_toCurrentPoint.y());

    animatedPoint = blendFloatPoint(fromPoint, animatedPoint, m_progress);

    if (m_isInFirstHalfOfAnimation)
        return animatedPoint;

    // Transform the animated point to the coordinate mode, needed for the current progress.
    FloatPoint currentPoint = blendFloatPoint(m_fromCurrentPoint, m_toCurrentPoint, m_progress);
    if (m_toMode == AbsoluteCoordinates)
        return animatedPoint + currentPoint;

    animatedPoint.move(-currentPoint.x(), -currentPoint.y());
    return animatedPoint;
}
FloatPoint SVGPathBlender::BlendState::blendAnimatedFloatPointSameCoordinates(const FloatPoint& fromPoint, const FloatPoint& toPoint)
{
    if (m_addTypesCount) {
        FloatPoint repeatedToPoint = toPoint;
        repeatedToPoint.scale(m_addTypesCount, m_addTypesCount);
        return fromPoint + repeatedToPoint;
    }
    return blendFloatPoint(fromPoint, toPoint, m_progress);
}