MCPcopy Create free account
hub / github.com/Snapchat/Valdi / processAnimations

Method processAnimations

snap_drawing/src/snap_drawing/cpp/Layers/Layer.cpp:774–808  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

772};
773
774void Layer::processAnimations(Duration delta) {
775 _enqueuedFrame = std::nullopt;
776
777 if (_animations.empty()) {
778 return;
779 }
780
781 Valdi::SmallVector<AnimationToProcess, 4> collectedAnimations;
782
783 // Collect all the animations to process
784 {
785 auto animations = _animations.readAccess();
786 for (const auto& it : animations) {
787 collectedAnimations.emplace_back(it.first, it.second);
788 }
789 }
790
791 // Process all our animations with the delta.
792 // We remove the ones that have completed
793 for (const auto& animationToProcess : collectedAnimations) {
794 auto completed = animationToProcess.animation->run(*this, delta);
795 if (completed) {
796 {
797 auto animations = _animations.writeAccess();
798 const auto& it = animations->find(animationToProcess.key);
799 if (it != animations->end() && it->second == animationToProcess.animation) {
800 animations->erase(it);
801 }
802 }
803 animationToProcess.animation->complete(*this);
804 }
805 }
806
807 scheduleProcessAnimationsIfNeeded();
808}
809
810std::optional<Point> Layer::convertPointToLayer(Point point, const Valdi::Ref<Layer>& childLayer) const {
811 thread_local std::vector<Ref<Layer>> kDescendants;

Callers 1

Calls 8

endMethod · 0.65
emptyMethod · 0.45
readAccessMethod · 0.45
runMethod · 0.45
writeAccessMethod · 0.45
findMethod · 0.45
eraseMethod · 0.45
completeMethod · 0.45

Tested by

no test coverage detected