当前位置: 首页>>代码示例>>C++>>正文


C++ TimingFunction类代码示例

本文整理汇总了C++中TimingFunction的典型用法代码示例。如果您正苦于以下问题:C++ TimingFunction类的具体用法?C++ TimingFunction怎么用?C++ TimingFunction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了TimingFunction类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: switch

void CompositorAnimationsImpl::addKeyframesToCurve(blink::WebAnimationCurve& curve, const KeyframeVector& keyframes, const TimingFunction& timingFunction)
{
    for (size_t i = 0; i < keyframes.size(); i++) {
        const TimingFunction* keyframeTimingFunction = 0;
        if (i + 1 < keyframes.size()) { // Last keyframe has no timing function
            switch (timingFunction.type()) {
            case TimingFunction::LinearFunction:
            case TimingFunction::CubicBezierFunction:
                keyframeTimingFunction = &timingFunction;
                break;

            case TimingFunction::ChainedFunction: {
                const ChainedTimingFunction& chained = toChainedTimingFunction(timingFunction);
                // ChainedTimingFunction criteria was checked in isCandidate,
                // assert it is valid.
                ASSERT(keyframes.size() == chained.m_segments.size() + 1);

                keyframeTimingFunction = chained.m_segments[i].m_timingFunction.get();
                break;
            }
            case TimingFunction::StepsFunction:
            default:
                ASSERT_NOT_REACHED();
            }
        }

        ASSERT(!keyframes[i]->value()->dependsOnUnderlyingValue());
        RefPtr<AnimatableValue> value = keyframes[i]->value()->compositeOnto(0);

        switch (curve.type()) {
        case blink::WebAnimationCurve::AnimationCurveTypeFilter: {
            OwnPtr<blink::WebFilterOperations> ops = adoptPtr(blink::Platform::current()->compositorSupport()->createFilterOperations());
            bool converted = toWebFilterOperations(toAnimatableFilterOperations(value.get())->operations(), ops.get());
            ASSERT_UNUSED(converted, converted);

            blink::WebFilterKeyframe filterKeyframe(keyframes[i]->offset(), ops.release());
            blink::WebFilterAnimationCurve* filterCurve = static_cast<blink::WebFilterAnimationCurve*>(&curve);
            addKeyframeWithTimingFunction(*filterCurve, filterKeyframe, keyframeTimingFunction);
            break;
        }
        case blink::WebAnimationCurve::AnimationCurveTypeFloat: {
            blink::WebFloatKeyframe floatKeyframe(keyframes[i]->offset(), toAnimatableDouble(value.get())->toDouble());
            blink::WebFloatAnimationCurve* floatCurve = static_cast<blink::WebFloatAnimationCurve*>(&curve);
            addKeyframeWithTimingFunction(*floatCurve, floatKeyframe, keyframeTimingFunction);
            break;
        }
        case blink::WebAnimationCurve::AnimationCurveTypeTransform: {
            OwnPtr<blink::WebTransformOperations> ops = adoptPtr(blink::Platform::current()->compositorSupport()->createTransformOperations());
            toWebTransformOperations(toAnimatableTransform(value.get())->transformOperations(), FloatSize(), ops.get());

            blink::WebTransformKeyframe transformKeyframe(keyframes[i]->offset(), ops.release());
            blink::WebTransformAnimationCurve* transformCurve = static_cast<blink::WebTransformAnimationCurve*>(&curve);
            addKeyframeWithTimingFunction(*transformCurve, transformKeyframe, keyframeTimingFunction);
            break;
        }
        default:
            ASSERT_NOT_REACHED();
        }
    }
}
开发者ID:wangshijun,项目名称:Blink,代码行数:60,代码来源:CompositorAnimations.cpp

示例2: PrintTo

// The generic PrintTo *must* come after the non-generic PrintTo otherwise it
// will end up calling itself.
void PrintTo(const TimingFunction& timingFunction, ::std::ostream* os)
{
    switch (timingFunction.type()) {
    case TimingFunction::LinearFunction: {
        const LinearTimingFunction& linear = toLinearTimingFunction(timingFunction);
        PrintTo(linear, os);
        return;
    }
    case TimingFunction::CubicBezierFunction: {
        const CubicBezierTimingFunction& cubic = toCubicBezierTimingFunction(timingFunction);
        PrintTo(cubic, os);
        return;
    }
    case TimingFunction::StepsFunction: {
        const StepsTimingFunction& step = toStepsTimingFunction(timingFunction);
        PrintTo(step, os);
        return;
    }
    case TimingFunction::ChainedFunction: {
        const ChainedTimingFunction& chained = toChainedTimingFunction(timingFunction);
        PrintTo(chained, os);
        return;
    }
    default:
        ASSERT_NOT_REACHED();
    }
}
开发者ID:Igalia,项目名称:blink,代码行数:29,代码来源:TimingFunctionTestHelper.cpp

示例3: toStepsTimingFunction

bool operator==(const StepsTimingFunction& lhs, const TimingFunction& rhs)
{
    if (rhs.type() != TimingFunction::StepsFunction)
        return false;

    const StepsTimingFunction& stf = toStepsTimingFunction(rhs);
    return (lhs.numberOfSteps() == stf.numberOfSteps()) && (lhs.stepAtPosition() == stf.stepAtPosition());
}
开发者ID:dstockwell,项目名称:blink,代码行数:8,代码来源:TimingFunction.cpp

示例4: toStepsTimingFunction

bool operator==(const StepsTimingFunction& lhs, const TimingFunction& rhs)
{
    if (rhs.type() != TimingFunction::StepsFunction)
        return false;

    const StepsTimingFunction& stf = toStepsTimingFunction(rhs);
    if ((lhs.subType() == StepsTimingFunction::Custom) && (stf.subType() == StepsTimingFunction::Custom))
        return (lhs.numberOfSteps() == stf.numberOfSteps()) && (lhs.stepAtStart() == stf.stepAtStart());

    return lhs.subType() == stf.subType();
}
开发者ID:Igalia,项目名称:blink,代码行数:11,代码来源:TimingFunctionTestHelper.cpp

示例5: toCubicBezierTimingFunction

bool operator==(const CubicBezierTimingFunction& lhs, const TimingFunction& rhs)
{
    if (rhs.type() != TimingFunction::CubicBezierFunction)
        return false;

    const CubicBezierTimingFunction& ctf = toCubicBezierTimingFunction(rhs);
    if ((lhs.subType() == CubicBezierTimingFunction::Custom) && (ctf.subType() == CubicBezierTimingFunction::Custom))
        return (lhs.x1() == ctf.x1()) && (lhs.y1() == ctf.y1()) && (lhs.x2() == ctf.x2()) && (lhs.y2() == ctf.y2());

    return lhs.subType() == ctf.subType();
}
开发者ID:Igalia,项目名称:blink,代码行数:11,代码来源:TimingFunctionTestHelper.cpp

示例6: switch

/* static */
Maybe<ComputedTimingFunction>
AnimationUtils::TimingFunctionToComputedTimingFunction(
    const TimingFunction& aTimingFunction) {
  switch (aTimingFunction.type()) {
    case TimingFunction::Tnull_t:
      return Nothing();
    case TimingFunction::TCubicBezierFunction: {
      CubicBezierFunction cbf = aTimingFunction.get_CubicBezierFunction();
      return Some(ComputedTimingFunction::CubicBezier(cbf.x1(), cbf.y1(),
                                                      cbf.x2(), cbf.y2()));
    }
    case TimingFunction::TStepFunction: {
      StepFunction sf = aTimingFunction.get_StepFunction();
      StyleStepPosition pos = static_cast<StyleStepPosition>(sf.type());
      return Some(ComputedTimingFunction::Steps(sf.steps(), pos));
    }
    default:
      MOZ_ASSERT_UNREACHABLE("Function must be null, bezier, step or frames");
      break;
  }
  return Nothing();
}
开发者ID:jasonLaster,项目名称:gecko-dev,代码行数:23,代码来源:LayerAnimationUtils.cpp

示例7: equals

    static bool equals(const ChainedTimingFunction& lhs, const TimingFunction& rhs)
    {
        if (rhs.type() != TimingFunction::ChainedFunction)
            return false;

        if (&lhs == &rhs)
            return true;

        const ChainedTimingFunction& ctf = toChainedTimingFunction(rhs);
        if (lhs.m_segments.size() != ctf.m_segments.size())
            return false;

        for (size_t i = 0; i < lhs.m_segments.size(); i++) {
            if (!equals(lhs.m_segments[i], ctf.m_segments[i]))
                return false;
        }
        return true;
    }
开发者ID:Igalia,项目名称:blink,代码行数:18,代码来源:TimingFunctionTestHelper.cpp

示例8: switch

// The generic operator== *must* come after the
// non-generic operator== otherwise it will end up calling itself.
bool operator==(const TimingFunction& lhs, const TimingFunction& rhs)
{
    switch (lhs.type()) {
    case TimingFunction::LinearFunction: {
        const LinearTimingFunction& linear = toLinearTimingFunction(lhs);
        return (linear == rhs);
    }
    case TimingFunction::CubicBezierFunction: {
        const CubicBezierTimingFunction& cubic = toCubicBezierTimingFunction(lhs);
        return (cubic == rhs);
    }
    case TimingFunction::StepsFunction: {
        const StepsTimingFunction& step = toStepsTimingFunction(lhs);
        return (step == rhs);
    }
    default:
        ASSERT_NOT_REACHED();
    }
    return false;
}
开发者ID:dstockwell,项目名称:blink,代码行数:22,代码来源:TimingFunction.cpp

示例9:

bool operator==(const LinearTimingFunction& lhs, const TimingFunction& rhs)
{
    return rhs.type() == TimingFunction::LinearFunction;
}
开发者ID:Igalia,项目名称:blink,代码行数:4,代码来源:TimingFunctionTestHelper.cpp

示例10: setTimingFunction

void CompositorTransformAnimationCurve::setTimingFunction(
    const TimingFunction& timingFunction) {
  m_curve->SetTimingFunction(timingFunction.cloneToCC());
}
开发者ID:mirror,项目名称:chromium,代码行数:4,代码来源:CompositorTransformAnimationCurve.cpp


注:本文中的TimingFunction类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。