1# Implicit Shared Element Transition (geometryTransition) (System API)
2
3**geometryTransition** is used to create a smooth, seamless transition between views. By specifying the frame and position of the in and out components through **geometryTransition**, you can create a spatial linkage between the transition effects (such as opacity and scale) defined through the **transition** mechanism. In this way, you can guide the visual focus from the previous view (out component) to the new view (in component).
4
5> **NOTE**
6>
7> This feature is supported since API version 7 and effective since API version 10. Updates will be marked with a superscript to indicate their earliest API version.
8>
9> For the settings to take effect, [geometryTransition](ts-transition-animation-geometrytransition.md) must be used together with [animateTo](ts-explicit-animation.md). The animation duration and curve follow the settings in [animateTo](ts-explicit-animation.md). [animation](ts-animatorproperty.md) is not supported.
10>
11> This topic describes only the system APIs provided by the module. For details about its public APIs, see [Implicit Shared Element Transition (geometryTransition)](ts-transition-animation-geometrytransition.md).
12
13## GeometryTransitionOptions<sup>11+<sup>
14
15**System capability**: SystemCapability.ArkUI.ArkUI.Full
16
17**Atomic service API**: This API can be used in atomic services since API version 11.
18
19**Parameters**
20
21| Name| Type| Mandatory| Description                                                                 |
22| ------ | -------- | ---- | ------------------------------------------------------------------------- |
23| hierarchyStrategy<sup>12+<sup> | [TransitionHierarchyStrategy](#transitionhierarchystrategy12)  | No  | <br>Strategy for the hierarchical position movement of in/out components in the component tree during the shared element transition process.<br>Default value: **TransitionHierarchyStrategy.ADAPTIVE**<br><br>The setting significantly affects the front-to-back overlap relationship of the in/out components in comparison to other components. Exercise caution with it under normal conditions.<br>You are advised to adjust this setting only when there is an error in the component overlap relationship observed during the shared element transition process.<br>**System API**: This is a system API.|
24
25## TransitionHierarchyStrategy<sup>12+<sup>
26Enumerates the strategies for the hierarchical position movement of in/out components in the component tree during the shared element transition process.
27
28**System capability**: SystemCapability.ArkUI.ArkUI.Full
29
30**Atomic service API**: This API can be used in atomic services since API version 12.
31
32**System API**: This is a system API.
33
34| Name  | Value| Description|
35| ------ | - | ---- |
36| NONE  | 0 | The in/out components maintain their original hierarchical positions and are affected by the scale and position of their parent components.|
37| ADAPTIVE | 1 | Relatively lower-level in/out components are promoted to a higher position in the component tree relative to the higher-level in/out components.<br>This mode also causes the promoted components to be decoupled from their parent components, not affected by the scale and position of their parent components.<br>For example, if the in component is at a higher hierarchy level than the out component, in this mode the out component will be decoupled from its own parent component during the animation process and promoted to the hierarchical position of the in component, while the in component's hierarchical position remains unchanged.|
38
39## Example
40
41```ts
42// xxx.ets
43@Entry
44@Component
45struct Index {
46  @State isShow: boolean = false
47
48  build() {
49    Stack({ alignContent: Alignment.Center }) {
50      if (this.isShow) {
51        Image($r('app.media.pic'))
52          .autoResize(false)
53          .clip(true)
54          .width(300)
55          .height(400)
56          .offset({ y: 100 })
57          .geometryTransition("picture", {hierarchyStrategy: TransitionHierarchyStrategy.ADAPTIVE})
58          .transition(TransitionEffect.OPACITY)
59      } else {
60        // geometryTransition is bound to a container. Therefore, a relative layout must be configured for the child components of the container.
61        // The multiple levels of containers here are used to demonstrate passing of relative layout constraints.
62        Column() {
63          Column() {
64            Image($r('app.media.icon'))
65              .width('100%').height('100%')
66          }.width('100%').height('100%')
67        }
68        .width(80)
69        .height(80)
70        // geometryTransition synchronizes rounded corner settings, but only for the bound component, which is the container in this example.
71        // In other words, rounded corner settings of the container are synchronized, and those of the child components are not.
72        .borderRadius(20)
73        .clip(true)
74        .geometryTransition("picture", {hierarchyStrategy: TransitionHierarchyStrategy.ADAPTIVE})
75        // transition ensures that the component is not destructed immediately when it exits. You can customize the transition effect.
76        .transition(TransitionEffect.OPACITY)
77      }
78    }
79    .onClick(() => {
80      animateTo({ duration: 1000 }, () => {
81        this.isShow = !this.isShow
82      })
83    })
84  }
85}
86```
87