• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
20 namespace OHOS::Ace {
21 namespace {
22 
23 const ComposeId PREFIX = "BackendTransition";
24 uint32_t g_transitionComponentId = 0;
25 
26 } // namespace
27 
CreateElement()28 RefPtr<Element> TransitionComponent::CreateElement()
29 {
30     return AceType::MakeRefPtr<TransitionElement>(GetId());
31 }
32 
SetTransitionOption(const TweenOption & in,const TweenOption & out)33 void TransitionComponent::SetTransitionOption(const TweenOption& in, const TweenOption& out)
34 {
35     inOption_ = in;
36     outOption_ = out;
37 }
38 
GetTransitionInOption() const39 const TweenOption& TransitionComponent::GetTransitionInOption() const
40 {
41     return inOption_;
42 }
43 
GetTransitionOutOption() const44 const TweenOption& TransitionComponent::GetTransitionOutOption() const
45 {
46     return outOption_;
47 }
48 
AllocTransitionComponentId()49 ComposeId TransitionComponent::AllocTransitionComponentId()
50 {
51     return PREFIX + (std::to_string(g_transitionComponentId++));
52 }
53 
IsFirstFrameShow() const54 bool TransitionComponent::IsFirstFrameShow() const
55 {
56     return isFirstFrameShow_;
57 }
58 
SetIsFirstFrameShow(bool isFirstFrameShow)59 void TransitionComponent::SetIsFirstFrameShow(bool isFirstFrameShow)
60 {
61     isFirstFrameShow_ = isFirstFrameShow;
62 }
63 
64 } // namespace OHOS::Ace