Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
72151b45
H
hello uni-app x
项目概览
DCloud
/
hello uni-app x
通知
5995
Star
90
Fork
162
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
18
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hello uni-app x
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
18
Issue
18
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
72151b45
编写于
5月 27, 2024
作者:
W
wanganxp
提交者:
雪洛
6月 27, 2024
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
css的transition示例补充渐隐渐现
上级
a0ea9385
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
76 addition
and
56 deletion
+76
-56
pages/CSS/transition/transition.uvue
pages/CSS/transition/transition.uvue
+76
-56
未找到文件。
pages/CSS/transition/transition.uvue
浏览文件 @
72151b45
...
@@ -2,64 +2,67 @@
...
@@ -2,64 +2,67 @@
<!-- #ifdef APP -->
<!-- #ifdef APP -->
<scroll-view style="flex: 1">
<scroll-view style="flex: 1">
<!-- #endif -->
<!-- #endif -->
<view>
<view class="container">
<view class="container">
<text class="text">点击修改宽度</text>
<text class="text">点击修改宽度</text>
<view class="base-style transition-width" id="widthOrHeight" @click="changeWidthOrHeight"></view>
<view class="base-style transition-width" id="widthOrHeight" @click="changeWidthOrHeight"></view>
</view>
</view>
<view class="container">
<view class="container">
<text class="text">点击修改宽度(递增)</text>
<text class="text">点击修改宽度(递增)</text>
<view class="width-progress transition-width" id="widthProgress" @click="changeWidthProgress"></view>
<view class="width-progress transition-width" id="widthProgress" @click="changeWidthProgress"></view>
</view>
</view>
<view class="container">
<view class="container">
<text class="text">点击修改Margin</text>
<text class="text">点击修改Margin</text>
<view class="base-style transition-margin" id="styleMargin" @click="changeMargin"></view>
<view class="base-style transition-margin" id="styleMargin" @click="changeMargin"></view>
</view>
</view>
<view class="container">
<view class="container">
<text class="text">点击修改Padding</text>
<text class="text">点击修改Padding</text>
<view class="base-style transition-padding" id="stylePadding" @click="changePadding">
<view class="base-style transition-padding" id="stylePadding" @click="changePadding">
<view style="background-color: black; height: 50px; width: 50px"></view>
<view style="background-color: black; height: 50px; width: 50px"></view>
</view>
</view>
<view class="container">
<text class="text">点击修改background-color和opacity</text>
<view class="base-style transition-background" id="styleBackground" @click="changeBackground"></view>
</view>
<view class="container">
<text class="text">点击修改background-color(rgba)</text>
<view style="flex: 1;">
<view class="base-style transition-background" id="styleBackground2" @click="changeBackground2"></view>
</view>
</view>
<view class="container">
<text class="text">动态修改background-color和duration</text>
<view class="base-style" id="propertyStyleBackground" @click="propertyChangeBackground"></view>
</view>
<view class="container">
<text class="text">点击修改Transform</text>
<view class="base-style transition-transform" id="styleTransform" @click="changeTransform"></view>
</view>
<view class="container">
<text class="text">点击修改TransformTranslate</text>
<view class="base-style transition-transform" id="transformTranslate" @click="changeTransformTranslate"></view>
</view>
<view class="container">
<text class="text">点击修改Transform和宽</text>
<view class="base-style transition-transform-width" id="styleTransformWithWidth" @click="changeTransformWithWidth"></view>
</view>
<view class="container" @click="changeTransformWithOrigin">
<text class="text">点击修改Transform(含transform-origin)</text>
<view class="base-style transition-transform" style="transform-origin: 0 0;" id="styleTransformWithOrigin"></view>
</view>
<view class="container">
<text class="text">点击修改Border</text>
<view class="base-style transition-border" id="styleBorder" @click="changeBorder"></view>
</view>
</view>
<view class="container">
</view>
<text class="text">点击修改Position</text>
<view class="container">
<view class="base-style transition-position" id="stylePosition" @click="changestylePosition"></view>
<text class="text">点击修改background-color和opacity</text>
<view class="base-style transition-background" id="styleBackground" @click="changeBackground"></view>
</view>
<view class="container">
<text class="text">点击修改background-color(rgba)</text>
<view style="flex: 1;">
<view class="base-style transition-background" id="styleBackground2" @click="changeBackground2"></view>
</view>
</view>
</view>
</view>
<view class="container">
<text class="text">点击修改opacity渐隐渐现</text>
<view class="base-style transition-opacity" id="styleOpacity" @click="changeStyleOpacity"></view>
</view>
<view class="container">
<text class="text">动态修改background-color和duration</text>
<view class="base-style" id="propertyStyleBackground" @click="propertyChangeBackground"></view>
</view>
<view class="container">
<text class="text">点击修改Transform</text>
<view class="base-style transition-transform" id="styleTransform" @click="changeTransform"></view>
</view>
<view class="container">
<text class="text">点击修改TransformTranslate</text>
<view class="base-style transition-transform" id="transformTranslate" @click="changeTransformTranslate"></view>
</view>
<view class="container">
<text class="text">点击修改Transform和宽</text>
<view class="base-style transition-transform-width" id="styleTransformWithWidth"
@click="changeTransformWithWidth"></view>
</view>
<view class="container" @click="changeTransformWithOrigin">
<text class="text">点击修改Transform(含transform-origin)</text>
<view class="base-style transition-transform" style="transform-origin: 0 0;" id="styleTransformWithOrigin"></view>
</view>
<view class="container">
<text class="text">点击修改Border</text>
<view class="base-style transition-border" id="styleBorder" @click="changeBorder"></view>
</view>
<view class="container">
<text class="text">点击修改Position</text>
<view class="base-style transition-position" id="stylePosition" @click="changestylePosition"></view>
</view>
<!-- #ifdef APP -->
<!-- #ifdef APP -->
</scroll-view>
</scroll-view>
<!-- #endif -->
<!-- #endif -->
...
@@ -79,11 +82,13 @@
...
@@ -79,11 +82,13 @@
stylePadding: null as UniElement | null,
stylePadding: null as UniElement | null,
isTransitionstyleBackground: false,
isTransitionstyleBackground: false,
isTransitionstyleBackground2: false,
isTransitionstyleBackground2: false,
isTransitionstyleOpacity: false,
styleBackground: null as UniElement | null,
styleBackground: null as UniElement | null,
styleBackground2: null as UniElement | null,
styleBackground2: null as UniElement | null,
styleOpacity: null as UniElement | null,
isTransitionStyleTransform: false,
isTransitionStyleTransform: false,
styleTransform: null as UniElement | null,
styleTransform: null as UniElement | null,
isTransitionStyleTransformWithWidth:false,
isTransitionStyleTransformWithWidth:
false,
styleTransformWithWidth: null as UniElement | null,
styleTransformWithWidth: null as UniElement | null,
isTransitionstyleBorder: false,
isTransitionstyleBorder: false,
styleBorder: null as UniElement | null,
styleBorder: null as UniElement | null,
...
@@ -105,6 +110,7 @@
...
@@ -105,6 +110,7 @@
this.stylePadding = uni.getElementById("stylePadding")
this.stylePadding = uni.getElementById("stylePadding")
this.styleBackground = uni.getElementById("styleBackground")
this.styleBackground = uni.getElementById("styleBackground")
this.styleBackground2 = uni.getElementById("styleBackground2")
this.styleBackground2 = uni.getElementById("styleBackground2")
this.styleOpacity = uni.getElementById("styleOpacity")
this.styleTransform = uni.getElementById("styleTransform")
this.styleTransform = uni.getElementById("styleTransform")
this.styleBorder = uni.getElementById("styleBorder")
this.styleBorder = uni.getElementById("styleBorder")
this.stylePosition = uni.getElementById("stylePosition")
this.stylePosition = uni.getElementById("stylePosition")
...
@@ -163,6 +169,14 @@
...
@@ -163,6 +169,14 @@
)
)
this.isTransitionstyleBackground2 = !this.isTransitionstyleBackground2
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() {
propertyChangeBackground() {
if (!this.isSetTransition) {
if (!this.isSetTransition) {
this.propertyStyleBackground?.style?.setProperty("transition-property", "background-color")
this.propertyStyleBackground?.style?.setProperty("transition-property", "background-color")
...
@@ -271,6 +285,11 @@
...
@@ -271,6 +285,11 @@
transition-duration: 1s;
transition-duration: 1s;
}
}
.transition-opacity {
transition-property: opacity;
transition-duration: 1s;
}
.transition-transform {
.transition-transform {
transition-property: transform;
transition-property: transform;
transition-duration: 1s;
transition-duration: 1s;
...
@@ -289,6 +308,7 @@
...
@@ -289,6 +308,7 @@
transition-property: left;
transition-property: left;
transition-duration: 1s;
transition-duration: 1s;
}
}
.transition-transform-width {
.transition-transform-width {
transition-property: transform, width;
transition-property: transform, width;
transition-duration: 1s;
transition-duration: 1s;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录