diff --git a/AnimationDemos/entry/src/main/ets/common/utils/customtransition/BookFlipLongTakeTransitionProperties.ets b/AnimationDemos/entry/src/main/ets/common/utils/customtransition/BookFlipLongTakeTransitionProperties.ets index 7078ddae2b7f1789662a9a75172e479d6a2dc9f9..f09224d6393b64c3ee134fd10a15e5684ede35df 100644 --- a/AnimationDemos/entry/src/main/ets/common/utils/customtransition/BookFlipLongTakeTransitionProperties.ets +++ b/AnimationDemos/entry/src/main/ets/common/utils/customtransition/BookFlipLongTakeTransitionProperties.ets @@ -59,8 +59,10 @@ export class BookFlipLongTakeTransitionProperties { public coverTranslateX: number = 0; public clipWidth: Dimension = 0; public clipHeight: Dimension = 0; - public contentScaleY?: number = undefined - public contentScaleX?: number = undefined + public contentScaleY: number = 1; + public contentScaleX: number = 1; + public contentHeight: Dimension = '100%'; + public contentWidth: Dimension = '100%' public doAnimation(fromCardItemInfo_px: RectInfoInPx, toCardItemInfo_px: RectInfoInPx): void { @@ -161,8 +163,10 @@ export class BookFlipLongTakeTransitionProperties { this.translateY = 0; this.rotateAngle = -90; this.coverScale = 0; - this.contentScaleX = undefined; - this.contentScaleY = undefined; + this.contentHeight = '100%'; + this.contentWidth = '100%'; + this.contentScaleX = 1; + this.contentScaleY = 1; } }) } @@ -193,12 +197,14 @@ export class BookFlipLongTakeTransitionProperties { this.clipHeight = initClipHeight; this.scaleYValue = initScaleYValue; this.translateY = deltaTranslateY; + this.contentHeight = px2vp(WindowUtils.windowHeight_px); this.contentScaleY = 1 / this.scaleYValue; // 抵消容器scale带来内容的变形 } if (this.clipWidth !== initClipWidth && !initInfo.isUseWidthScale) { this.clipWidth = initClipWidth; this.scaleXValue = initScaleXValue; this.translateX = deltaTranslateX; + this.contentWidth = px2vp(WindowUtils.windowWidth_px); this.contentScaleX = 1 / this.scaleXValue; } @@ -208,14 +214,12 @@ export class BookFlipLongTakeTransitionProperties { if (initInfo.isUseWidthScale) { this.scaleXValue = 1 - (1 - initScale) * progress; this.scaleYValue = initScaleYValue + (initScale - initScaleYValue) * progress; - this.contentScaleY = 1 / this.scaleYValue * this.scaleXValue; this.translateX = initTranslateX * progress; this.translateY = deltaTranslateY * (1 - progress) + initTranslateY * progress; } else { this.scaleYValue = 1 - (1 - initScale) * progress; this.scaleXValue = initScaleYValue + (initScale - initScaleYValue) * progress; this.contentScaleX = 1 / this.scaleXValue * this.scaleYValue; - this.translateY = initTranslateY * progress; this.translateX = deltaTranslateX * (1 - progress) + initTranslateX * progress; } this.coverScale = progress; diff --git a/AnimationDemos/entry/src/main/ets/pages/Transition/LongTakeTransition/BookFlipLongTakeTransition/BookFlipLongTakeTransitionPageTwo.ets b/AnimationDemos/entry/src/main/ets/pages/Transition/LongTakeTransition/BookFlipLongTakeTransition/BookFlipLongTakeTransitionPageTwo.ets index 2ee63903827e819f6b5fd0cf042de4a888f8a237..d3b50e15961179437bb9020655ac42a295c3140a 100644 --- a/AnimationDemos/entry/src/main/ets/pages/Transition/LongTakeTransition/BookFlipLongTakeTransition/BookFlipLongTakeTransitionPageTwo.ets +++ b/AnimationDemos/entry/src/main/ets/pages/Transition/LongTakeTransition/BookFlipLongTakeTransition/BookFlipLongTakeTransitionPageTwo.ets @@ -68,15 +68,17 @@ export struct BookFlipLongTakeTransitionPageTwo { build() { NavDestination() { Stack() { - Stack() { + Column() { Text($r('app.string.DetailPage_text')) .fontColor(Color.White) } + .justifyContent(FlexAlign.Center) + .width(this.bookFlipLongTakeTransitionProperties.contentWidth) + .height(this.bookFlipLongTakeTransitionProperties.clipHeight) .scale({ y: this.bookFlipLongTakeTransitionProperties.contentScaleY, x: this.bookFlipLongTakeTransitionProperties.contentScaleX }) - .width('100%') if (!this.doDefaultTransition) { Image($r(this.bookCoverUrl))