本文整理汇总了C++中StaticSprite2D::SetAlpha方法的典型用法代码示例。如果您正苦于以下问题:C++ StaticSprite2D::SetAlpha方法的具体用法?C++ StaticSprite2D::SetAlpha怎么用?C++ StaticSprite2D::SetAlpha使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StaticSprite2D
的用法示例。
在下文中一共展示了StaticSprite2D::SetAlpha方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fmodf
//.........这里部分代码省略.........
{
trackNodeInfos_[i].worldSpace = false;
const AnimationTrack2D& track = animation_->GetTrack(i);
const Vector<AnimationKeyFrame2D>& keyFrames = track.keyFrames_;
// Time out of range
if (time < keyFrames[0].time_ || time > keyFrames.Back().time_)
trackNodeInfos_[i].value.enabled_ = false;
else
{
unsigned index = keyFrames.Size() - 1;
for (unsigned j = 0; j < keyFrames.Size() - 1; ++j)
{
if (time <= keyFrames[j + 1].time_)
{
index = j;
break;
}
}
const AnimationKeyFrame2D& currKey = keyFrames[index];
AnimationKeyFrame2D& value = trackNodeInfos_[i].value;
value.enabled_ = currKey.enabled_;
value.parent_ = currKey.parent_;
if (index < keyFrames.Size() - 1)
{
const AnimationKeyFrame2D& nextKey = keyFrames[index + 1];
float t = (time - currKey.time_) / (nextKey.time_ - currKey.time_);
value.transform_ = currKey.transform_.Lerp(nextKey.transform_, t, currKey.spin_);
if (trackNodeInfos_[i].hasSprite)
value.alpha_ = Atomic::Lerp(currKey.alpha_, nextKey.alpha_, t);
}
else
{
value.transform_ = currKey.transform_;
if (trackNodeInfos_[i].hasSprite)
value.alpha_ = currKey.alpha_;
}
if (trackNodeInfos_[i].hasSprite)
{
value.zIndex_ = currKey.zIndex_;
value.sprite_ = currKey.sprite_;
value.useHotSpot_ = currKey.useHotSpot_;
value.hotSpot_ = currKey.hotSpot_;
}
}
}
for (unsigned i = 0; i < numTracks_; ++i)
{
Node* node = trackNodes_[i];
if (!node)
continue;
TrackNodeInfo& nodeInfo = trackNodeInfos_[i];
if (!nodeInfo.value.enabled_)
node->SetEnabled(false);
else
{
node->SetEnabled(true);
// Calculate world transform.
CalculateTimelineWorldTransform(i);
// Update node's transform
Vector2 position = nodeInfo.value.transform_.position_ * PIXEL_SIZE;
if (flipX_)
position.x_ = -position.x_;
if (flipY_)
position.y_ = -position.y_;
node->SetPosition(position);
float angle = nodeInfo.value.transform_.angle_;
if (flipX_ != flipY_)
angle = -angle;
node->SetRotation(angle);
node->SetScale(nodeInfo.value.transform_.scale_);
if (nodeInfo.hasSprite)
{
StaticSprite2D* staticSprite = node->GetComponent<StaticSprite2D>();
if (staticSprite)
{
staticSprite->SetOrderInLayer(orderInLayer_ + nodeInfo.value.zIndex_);
staticSprite->SetSprite(nodeInfo.value.sprite_);
staticSprite->SetAlpha(nodeInfo.value.alpha_);
staticSprite->SetUseHotSpot(nodeInfo.value.useHotSpot_);
staticSprite->SetHotSpot(nodeInfo.value.hotSpot_);
}
}
}
}
}