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


C++ AnimationPlayer类代码示例

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


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

示例1: play

 AnimationPlayer* play(Animation* animation, double startTime)
 {
     AnimationPlayer* player = timeline->play(animation);
     player->setStartTime(startTime * 1000);
     player->update(TimingUpdateOnDemand);
     return player;
 }
开发者ID:kingysu,项目名称:blink-crosswalk,代码行数:7,代码来源:AnimationStackTest.cpp

示例2: TRACE_EVENT0

void AnimationTimeline::serviceAnimations(TimingUpdateReason reason)
{
    TRACE_EVENT0("blink", "AnimationTimeline::serviceAnimations");

    m_timing->cancelWake();

    double timeToNextEffect = std::numeric_limits<double>::infinity();

    Vector<RawPtr<AnimationPlayer> > players;
    players.reserveInitialCapacity(m_playersNeedingUpdate.size());
    for (HashSet<RefPtr<AnimationPlayer> >::iterator it = m_playersNeedingUpdate.begin(); it != m_playersNeedingUpdate.end(); ++it)
        players.append(it->get());

    std::sort(players.begin(), players.end(), AnimationPlayer::hasLowerPriority);

    for (size_t i = 0; i < players.size(); ++i) {
        AnimationPlayer* player = players[i];
        if (player->update(reason))
            timeToNextEffect = std::min(timeToNextEffect, player->timeToEffectChange());
        else
            m_playersNeedingUpdate.remove(player);
    }

    if (timeToNextEffect < s_minimumDelay)
        m_timing->serviceOnNextFrame();
    else if (timeToNextEffect != std::numeric_limits<double>::infinity())
        m_timing->wakeAfter(timeToNextEffect - s_minimumDelay);

    ASSERT(!hasOutdatedAnimationPlayer());
}
开发者ID:Miaque,项目名称:mojo,代码行数:30,代码来源:AnimationTimeline.cpp

示例3: notifyCompositorAnimationStarted

void CompositorPendingAnimations::notifyCompositorAnimationStarted(double monotonicAnimationStartTime)
{
    for (size_t i = 0; i < m_waitingForCompositorAnimationStart.size(); ++i) {
        AnimationPlayer* player = m_waitingForCompositorAnimationStart[i].get();
        player->setStartTimeInternal(monotonicAnimationStartTime - player->timeline()->zeroTime(), true);
    }

    m_waitingForCompositorAnimationStart.clear();
}
开发者ID:darktears,项目名称:blink-crosswalk,代码行数:9,代码来源:CompositorPendingAnimations.cpp

示例4: createAnimationPlayer

AnimationPlayer* AnimationTimeline::play(AnimationNode* child)
{
    if (!m_document)
        return 0;
    AnimationPlayer* player = createAnimationPlayer(child);
    player->setStartTimeInternal(effectiveTime());
    m_document->compositorPendingAnimations().add(player);
    return player;
}
开发者ID:ericwilligers,项目名称:blink,代码行数:9,代码来源:AnimationTimeline.cpp

示例5: ASSERT

bool CompositorAnimations::startAnimationOnCompositor(const Element& element, int group, double startTime, double timeOffset, const Timing& timing, const AnimationPlayer& player, const AnimationEffect& effect, Vector<int>& startedAnimationIds, double playerPlaybackRate)
{
    ASSERT(startedAnimationIds.isEmpty());
    ASSERT(isCandidateForAnimationOnCompositor(timing, element, &player, effect, playerPlaybackRate));
    ASSERT(canStartAnimationOnCompositor(element));

    const KeyframeEffectModelBase& keyframeEffect = toKeyframeEffectModelBase(effect);

    DeprecatedPaintLayer* layer = toLayoutBoxModelObject(element.layoutObject())->layer();
    ASSERT(layer);

    Vector<OwnPtr<WebCompositorAnimation>> animations;
    CompositorAnimationsImpl::getAnimationOnCompositor(timing, group, startTime, timeOffset, keyframeEffect, animations, playerPlaybackRate);
    ASSERT(!animations.isEmpty());
    for (auto& animation : animations) {
        int id = animation->id();
        if (RuntimeEnabledFeatures::compositorAnimationTimelinesEnabled()) {
            WebCompositorAnimationPlayer* compositorPlayer = player.compositorPlayer();
            ASSERT(compositorPlayer);
            compositorPlayer->addAnimation(animation.leakPtr());
        } else if (!layer->compositedDeprecatedPaintLayerMapping()->mainGraphicsLayer()->addAnimation(animation.release())) {
            // FIXME: We should know ahead of time whether these animations can be started.
            for (int startedAnimationId : startedAnimationIds)
                cancelAnimationOnCompositor(element, player, startedAnimationId);
            startedAnimationIds.clear();
            return false;
        }
        startedAnimationIds.append(id);
    }
    ASSERT(!startedAnimationIds.isEmpty());
    return true;
}
开发者ID:kingysu,项目名称:blink-crosswalk,代码行数:32,代码来源:CompositorAnimations.cpp

示例6: getAnimationNameForInspector

const AtomicString CSSAnimations::getAnimationNameForInspector(const AnimationPlayer& player)
{
    for (const auto& it : m_animations) {
        if (it.value->sequenceNumber() == player.sequenceNumber())
            return it.key;
    }
    return nullAtom;
}
开发者ID:RobinWuDev,项目名称:Qt,代码行数:8,代码来源:CSSAnimations.cpp

示例7: TTR

String AnimationTree::get_configuration_warning() const {

	String warning = Node::get_configuration_warning();

	if (!root.is_valid()) {
		if (warning != String()) {
			warning += "\n";
		}
		warning += TTR("A root AnimationNode for the graph is not set.");
	}

	if (!has_node(animation_player)) {

		if (warning != String()) {
			warning += "\n";
		}

		warning += TTR("Path to an AnimationPlayer node containing animations is not set.");
		return warning;
	}

	AnimationPlayer *player = Object::cast_to<AnimationPlayer>(get_node(animation_player));

	if (!player) {
		if (warning != String()) {
			warning += "\n";
		}

		warning += TTR("Path set for AnimationPlayer does not lead to an AnimationPlayer node.");
		return warning;
	}

	if (!player->has_node(player->get_root())) {
		if (warning != String()) {
			warning += "\n";
		}

		warning += TTR("AnimationPlayer root is not a valid node.");
		return warning;
	}

	return warning;
}
开发者ID:Valentactive,项目名称:godot,代码行数:43,代码来源:animation_tree.cpp

示例8: GetComputedTiming

// http://w3c.github.io/web-animations/#in-play
bool
KeyframeEffectReadonly::IsInPlay(const AnimationPlayer& aPlayer) const
{
  if (IsFinishedTransition() ||
      aPlayer.PlayState() == AnimationPlayState::Finished) {
    return false;
  }

  return GetComputedTiming().mPhase == ComputedTiming::AnimationPhase_Active;
}
开发者ID:howareyou322,项目名称:gecko-dev,代码行数:11,代码来源:KeyframeEffect.cpp

示例9: ERR_FAIL_COND

void VisibilityEnabler::_change_node_state(Node *p_node, bool p_enabled) {

	ERR_FAIL_COND(!nodes.has(p_node));

	{
		RigidBody *rb = Object::cast_to<RigidBody>(p_node);
		if (rb)

			rb->set_sleeping(!p_enabled);
	}

	{
		AnimationPlayer *ap = Object::cast_to<AnimationPlayer>(p_node);

		if (ap) {

			ap->set_active(p_enabled);
		}
	}
}
开发者ID:bigscorpions,项目名称:godot,代码行数:20,代码来源:visibility_notifier.cpp

示例10: ERR_FAIL_COND

void VisibilityEnabler2D::_change_node_state(Node *p_node, bool p_enabled) {

	ERR_FAIL_COND(!nodes.has(p_node));

	{
		RigidBody2D *rb = Object::cast_to<RigidBody2D>(p_node);
		if (rb) {

			rb->set_sleeping(!p_enabled);
		}
	}

	{
		AnimationPlayer *ap = Object::cast_to<AnimationPlayer>(p_node);

		if (ap) {

			ap->set_active(p_enabled);
		}
	}
	{
		AnimatedSprite *as = Object::cast_to<AnimatedSprite>(p_node);

		if (as) {

			if (p_enabled)
				as->play();
			else
				as->stop();
		}
	}

	{
		Particles2D *ps = Object::cast_to<Particles2D>(p_node);

		if (ps) {

			ps->set_emitting(p_enabled);
		}
	}
}
开发者ID:bigscorpions,项目名称:godot,代码行数:41,代码来源:visibility_notifier_2d.cpp

示例11:

Vector<String> AnimationTreeEditor::get_animation_list() {

	if (!singleton->is_visible()) {
		return Vector<String>();
	}

	AnimationTree *tree = singleton->tree;
	if (!tree || !tree->has_node(tree->get_animation_player()))
		return Vector<String>();

	AnimationPlayer *ap = Object::cast_to<AnimationPlayer>(tree->get_node(tree->get_animation_player()));

	if (!ap)
		return Vector<String>();

	List<StringName> anims;
	ap->get_animation_list(&anims);
	Vector<String> ret;
	for (List<StringName>::Element *E = anims.front(); E; E = E->next()) {
		ret.push_back(E->get());
	}

	return ret;
}
开发者ID:ialex32x,项目名称:godot,代码行数:24,代码来源:animation_tree_editor_plugin.cpp

示例12: get_node

void AnimationTreePlayer::_update_sources() {

	if (master==NodePath())
		return;
	if (!is_inside_tree())
		return;

	Node *m = get_node(master);
	if (!m) {
		master=NodePath();
		ERR_FAIL_COND(!m);
	}

	AnimationPlayer *ap = m->cast_to<AnimationPlayer>();

	if (!ap) {

		master=NodePath();
		ERR_FAIL_COND(!ap);
	}

	for (Map<StringName,NodeBase*>::Element *E=node_map.front();E;E=E->next()) {

		if (E->get()->type==NODE_ANIMATION) {

			AnimationNode *an = static_cast<AnimationNode*>(E->get());

			if (an->from!="") {

				an->animation = ap->get_animation(an->from);
			}
		}
	}


}
开发者ID:RYG81,项目名称:godot,代码行数:36,代码来源:animation_tree_player.cpp

示例13: cancelAnimationOnCompositor

void CompositorAnimations::cancelAnimationOnCompositor(const Element& element, const AnimationPlayer& player, int id)
{
    if (!canStartAnimationOnCompositor(element)) {
        // When an element is being detached, we cancel any associated
        // AnimationPlayers for CSS animations. But by the time we get
        // here the mapping will have been removed.
        // FIXME: Defer remove/pause operations until after the
        // compositing update.
        return;
    }
    if (RuntimeEnabledFeatures::compositorAnimationTimelinesEnabled()) {
        WebCompositorAnimationPlayer* compositorPlayer = player.compositorPlayer();
        ASSERT(compositorPlayer);
        compositorPlayer->removeAnimation(id);
    } else {
        toLayoutBoxModelObject(element.layoutObject())->layer()->compositedDeprecatedPaintLayerMapping()->mainGraphicsLayer()->removeAnimation(id);
    }
}
开发者ID:kingysu,项目名称:blink-crosswalk,代码行数:18,代码来源:CompositorAnimations.cpp

示例14: ASSERT_NOT_REACHED

void CompositorAnimations::pauseAnimationForTestingOnCompositor(const Element& element, const AnimationPlayer& player, int id, double pauseTime)
{
    // FIXME: canStartAnimationOnCompositor queries compositingState, which is not necessarily up to date.
    // https://code.google.com/p/chromium/issues/detail?id=339847
    DisableCompositingQueryAsserts disabler;

    if (!canStartAnimationOnCompositor(element)) {
        ASSERT_NOT_REACHED();
        return;
    }
    if (RuntimeEnabledFeatures::compositorAnimationTimelinesEnabled()) {
        WebCompositorAnimationPlayer* compositorPlayer = player.compositorPlayer();
        ASSERT(compositorPlayer);
        compositorPlayer->pauseAnimation(id, pauseTime);
    } else {
        toLayoutBoxModelObject(element.layoutObject())->layer()->compositedDeprecatedPaintLayerMapping()->mainGraphicsLayer()->pauseAnimation(id, pauseTime);
    }
}
开发者ID:kingysu,项目名称:blink-crosswalk,代码行数:18,代码来源:CompositorAnimations.cpp

示例15: canAttachCompositedLayers

bool CompositorAnimations::canAttachCompositedLayers(const Element& element, const AnimationPlayer& player)
{
    if (!RuntimeEnabledFeatures::compositorAnimationTimelinesEnabled())
        return false;

    if (!player.compositorPlayer())
        return false;

    if (!element.layoutObject() || !element.layoutObject()->isBoxModelObject())
        return false;

    DeprecatedPaintLayer* layer = toLayoutBoxModelObject(element.layoutObject())->layer();

    if (!layer || !layer->isAllowedToQueryCompositingState()
        || !layer->compositedDeprecatedPaintLayerMapping()
        || !layer->compositedDeprecatedPaintLayerMapping()->mainGraphicsLayer())
        return false;

    if (!layer->compositedDeprecatedPaintLayerMapping()->mainGraphicsLayer()->platformLayer())
        return false;

    return true;
}
开发者ID:kingysu,项目名称:blink-crosswalk,代码行数:23,代码来源:CompositorAnimations.cpp


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