1 /* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #include "core/components/transition/transition_component.h" 17 18 #include "core/components/transition/transition_element.h" 19 #include "core/components/tween/tween_component.h" 20 21 namespace OHOS::Ace { 22 namespace { 23 24 const ComposeId PREFIX = "BackendTransition"; 25 uint32_t g_transitionComponentId = 0; 26 27 } // namespace 28 CreateElement()29RefPtr<Element> TransitionComponent::CreateElement() 30 { 31 return AceType::MakeRefPtr<TransitionElement>(GetId()); 32 } 33 SetTransitionOption(const TweenOption & in,const TweenOption & out)34void TransitionComponent::SetTransitionOption(const TweenOption& in, const TweenOption& out) 35 { 36 inOption_ = in; 37 outOption_ = out; 38 } 39 GetTransitionInOption() const40const TweenOption& TransitionComponent::GetTransitionInOption() const 41 { 42 return inOption_; 43 } 44 GetTransitionOutOption() const45const TweenOption& TransitionComponent::GetTransitionOutOption() const 46 { 47 return outOption_; 48 } 49 AllocTransitionComponentId()50ComposeId TransitionComponent::AllocTransitionComponentId() 51 { 52 return PREFIX + (std::to_string(g_transitionComponentId++)); 53 } 54 IsFirstFrameShow() const55bool TransitionComponent::IsFirstFrameShow() const 56 { 57 return isFirstFrameShow_; 58 } 59 SetIsFirstFrameShow(bool isFirstFrameShow)60void TransitionComponent::SetIsFirstFrameShow(bool isFirstFrameShow) 61 { 62 isFirstFrameShow_ = isFirstFrameShow; 63 } 64 65 } // namespace OHOS::Ace