1# Implicit Shared Element Transition (geometryTransition) 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## geometryTransition 12 13geometryTransition(id: string) 14 15Implements an implicit shared element transition. 16 17**System capability**: SystemCapability.ArkUI.ArkUI.Full 18 19**Parameters** 20 21| Name | Type | Mandatory| Description | 22| ------- | ------------------------ | ---- | ------------------------------------------------------------ | 23| id | string | Yes | ID used to set up a binding relationship. If this attribute is set to an empty string **""**, the binding relationship is cleared. The value can be dynamically changed to refresh the binding relationship. One ID can be bound to only two components, which function as in and out components.| 24 25## geometryTransition<sup>11+<sup> 26 27geometryTransition(id: string, options?: GeometryTransitionOptions) 28 29Implements an implicit shared element transition. 30 31**System capability**: SystemCapability.ArkUI.ArkUI.Full 32 33**Parameters** 34 35| Name | Type | Mandatory| Description | 36| ------- | ------------------------ | ---- | ------------------------------------------------------------ | 37| id | string | Yes | ID used to set up a binding relationship. If this attribute is set to an empty string **""**, the binding relationship is cleared. The value can be dynamically changed to refresh the binding relationship. One ID can be bound to only two components, which function as in and out components.| 38| options | [GeometryTransitionOptions](#geometrytransitionoptions11) | No | Settings of the implicit shared element transition. | 39 40## GeometryTransitionOptions<sup>11+<sup> 41 42**System capability**: SystemCapability.ArkUI.ArkUI.Full 43 44**Parameters** 45 46| Name| Type| Mandatory| Description | 47| ------ | -------- | ---- | ------------------------------------------------------------ | 48| follow | boolean | No | Whether to apply the animation to components that are always in the component tree. It is available only in the **if** syntax.<br>Default value: **false**| 49 50## Example 51 52```ts 53// xxx.ets 54@Entry 55@Component 56struct Index { 57 @State isShow: boolean = false 58 59 build() { 60 Stack({ alignContent: Alignment.Center }) { 61 if (this.isShow) { 62 Image($r('app.media.pic')) 63 .autoResize(false) 64 .clip(true) 65 .width(300) 66 .height(400) 67 .offset({ y: 100 }) 68 .geometryTransition("picture") 69 .transition(TransitionEffect.OPACITY) 70 } else { 71 // geometryTransition is bound to a container. Therefore, a relative layout must be configured for the child components of the container. 72 // The multiple levels of containers here are used to demonstrate passing of relative layout constraints. 73 Column() { 74 Column() { 75 Image($r('app.media.icon')) 76 .width('100%').height('100%') 77 }.width('100%').height('100%') 78 } 79 .width(80) 80 .height(80) 81 // geometryTransition synchronizes rounded corner settings, but only for the bound component, which is the container in this example. 82 // In other words, rounded corner settings of the container are synchronized, and those of the child components are not. 83 .borderRadius(20) 84 .clip(true) 85 .geometryTransition("picture") 86 // transition ensures that the component is not destructed immediately when it exits. You can customize the transition effect. 87 .transition(TransitionEffect.OPACITY) 88 } 89 } 90 .onClick(() => { 91 animateTo({ duration: 1000 }, () => { 92 this.isShow = !this.isShow 93 }) 94 }) 95 } 96} 97``` 98 99 100