diff --git a/pages/CSS/transition/transition.uvue b/pages/CSS/transition/transition.uvue index 7a604ceff4487c617fc5d687783ed20bbe652b49..d8d3afd22cd67a831870722e838caafd37c516d4 100644 --- a/pages/CSS/transition/transition.uvue +++ b/pages/CSS/transition/transition.uvue @@ -2,64 +2,67 @@ - - - 点击修改宽度 - - - - 点击修改宽度(递增) - - - - 点击修改Margin - - - - 点击修改Padding - - - - - - 点击修改background-color和opacity - - - - 点击修改background-color(rgba) - - - - - - 动态修改background-color和duration - - - - 点击修改Transform - - - - 点击修改TransformTranslate - - - - 点击修改Transform和宽 - - - - 点击修改Transform(含transform-origin) - - - - 点击修改Border - + + 点击修改宽度 + + + + 点击修改宽度(递增) + + + + 点击修改Margin + + + + 点击修改Padding + + - - 点击修改Position - + + + 点击修改background-color和opacity + + + + 点击修改background-color(rgba) + + + + 点击修改opacity渐隐渐现 + + + + 动态修改background-color和duration + + + + 点击修改Transform + + + + 点击修改TransformTranslate + + + + 点击修改Transform和宽 + + + + 点击修改Transform(含transform-origin) + + + + 点击修改Border + + + + 点击修改Position + + @@ -79,11 +82,13 @@ stylePadding: null as UniElement | null, isTransitionstyleBackground: false, isTransitionstyleBackground2: false, + isTransitionstyleOpacity: false, styleBackground: null as UniElement | null, styleBackground2: null as UniElement | null, + styleOpacity: null as UniElement | null, isTransitionStyleTransform: false, styleTransform: null as UniElement | null, - isTransitionStyleTransformWithWidth:false, + isTransitionStyleTransformWithWidth: false, styleTransformWithWidth: null as UniElement | null, isTransitionstyleBorder: false, styleBorder: null as UniElement | null, @@ -105,6 +110,7 @@ this.stylePadding = uni.getElementById("stylePadding") this.styleBackground = uni.getElementById("styleBackground") this.styleBackground2 = uni.getElementById("styleBackground2") + this.styleOpacity = uni.getElementById("styleOpacity") this.styleTransform = uni.getElementById("styleTransform") this.styleBorder = uni.getElementById("styleBorder") this.stylePosition = uni.getElementById("stylePosition") @@ -163,6 +169,14 @@ ) this.isTransitionstyleBackground2 = !this.isTransitionstyleBackground2 }, + changeStyleOpacity() { + this.styleOpacity?.style?.setProperty("opacity", this.isTransitionstyleOpacity + ? '1' + : '0' + ) + this.styleOpacity?.style?.setProperty("transition-duration", "1000ms") + this.isTransitionstyleOpacity = !this.isTransitionstyleOpacity + }, propertyChangeBackground() { if (!this.isSetTransition) { this.propertyStyleBackground?.style?.setProperty("transition-property", "background-color") @@ -271,6 +285,11 @@ transition-duration: 1s; } + .transition-opacity { + transition-property: opacity; + transition-duration: 1s; + } + .transition-transform { transition-property: transform; transition-duration: 1s; @@ -289,6 +308,7 @@ transition-property: left; transition-duration: 1s; } + .transition-transform-width { transition-property: transform, width; transition-duration: 1s;