提交 c1f0b69d 编写于 作者: 张磊

transition-duration 添加单位

上级 2f781c49
...@@ -288,6 +288,6 @@ ...@@ -288,6 +288,6 @@
border-style: solid; border-style: solid;
padding: 20rpx; padding: 20rpx;
transition: height; transition: height;
transition-duration: 300; transition-duration: 300ms;
} }
</style> </style>
...@@ -125,7 +125,7 @@ ...@@ -125,7 +125,7 @@
propertyChangeBackground() { propertyChangeBackground() {
if (!this.isSetTransition) { if (!this.isSetTransition) {
this.propertyStyleBackground?.style?.setProperty("transition-property", "background-color") this.propertyStyleBackground?.style?.setProperty("transition-property", "background-color")
this.propertyStyleBackground?.style?.setProperty("transition-duration", "1000") this.propertyStyleBackground?.style?.setProperty("transition-duration", "1000ms")
this.isSetTransition = true this.isSetTransition = true
} }
this.propertyStyleBackground?.style?.setProperty("background-color", this.isTransitionpropertystyleBackground this.propertyStyleBackground?.style?.setProperty("background-color", this.isTransitionpropertystyleBackground
...@@ -185,27 +185,27 @@ ...@@ -185,27 +185,27 @@
.transition-width { .transition-width {
transition-property: width; transition-property: width;
transition-duration: 1000; transition-duration: 1s;
} }
.transition-margin { .transition-margin {
transition-property: margin-left, margin-top; transition-property: margin-left, margin-top;
transition-duration: 1000; transition-duration: 1s;
} }
.transition-padding { .transition-padding {
transition-property: padding-left, padding-top; transition-property: padding-left, padding-top;
transition-duration: 1000; transition-duration: 1s;
} }
.transition-background { .transition-background {
transition-property: background-color, opacity; transition-property: background-color, opacity;
transition-duration: 1000; transition-duration: 1s;
} }
.transition-transform { .transition-transform {
transition-property: transform; transition-property: transform;
transition-duration: 1000; transition-duration: 1s;
} }
.transition-border { .transition-border {
...@@ -213,11 +213,11 @@ ...@@ -213,11 +213,11 @@
border-color: brown; border-color: brown;
border-style: solid; border-style: solid;
transition-property: border-color; transition-property: border-color;
transition-duration: 1000; transition-duration: 1s;
} }
.transition-position { .transition-position {
transition-property: left; transition-property: left;
transition-duration: 1000; transition-duration: 1s;
} }
</style> </style>
...@@ -30,14 +30,14 @@ ...@@ -30,14 +30,14 @@
this.buttonValue = "关闭图片旋转" this.buttonValue = "关闭图片旋转"
this.times = this.times + 1 this.times = this.times + 1
this.element!.style.setProperty('transform', 'rotate(' + this.times * 360 + 'deg)') this.element!.style.setProperty('transform', 'rotate(' + this.times * 360 + 'deg)')
this.element!.style.setProperty('transition-duration', '2000') this.element!.style.setProperty('transition-duration', '2000ms')
this.isStart = true this.isStart = true
} else { } else {
this.isStart = false this.isStart = false
this.times = 0 this.times = 0
this.buttonValue = "开启图片旋转" this.buttonValue = "开启图片旋转"
this.element!.style.setProperty('transform', 'rotate(' + this.times * 360 + 'deg)') this.element!.style.setProperty('transform', 'rotate(' + this.times * 360 + 'deg)')
this.element!.style.setProperty('transition-duration', '0') this.element!.style.setProperty('transition-duration', '0s')
} }
}, },
onEnd() { onEnd() {
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
height: 400rpx; height: 400rpx;
margin: 50rpx auto; margin: 50rpx auto;
border-radius: 200rpx; border-radius: 200rpx;
transition-duration: 2000; transition-duration: 2000ms;
transition-property: transform; transition-property: transform;
transition-timing-function: linear; transition-timing-function: linear;
transform: rotate(0deg); transform: rotate(0deg);
......
...@@ -103,7 +103,7 @@ ...@@ -103,7 +103,7 @@
this.halfNode?.style?.setProperty('transitionTimingFunction', 'linear'); this.halfNode?.style?.setProperty('transitionTimingFunction', 'linear');
time *= (this.halfHeight / this.totalHeight); //计算关闭动画时间 time *= (this.halfHeight / this.totalHeight); //计算关闭动画时间
} }
this.halfNode?.style?.setProperty('transitionDuration', time.toFixed(0)); this.halfNode?.style?.setProperty('transitionDuration', time.toFixed(0)+"ms");
this.halfNode?.style?.setProperty('transitionProperty', 'top'); this.halfNode?.style?.setProperty('transitionProperty', 'top');
this.halfNode?.style?.setProperty('top', top.toFixed(2)); this.halfNode?.style?.setProperty('top', top.toFixed(2));
setTimeout(() => { setTimeout(() => {
...@@ -119,7 +119,7 @@ ...@@ -119,7 +119,7 @@
}, },
resumeHalfScreen() { resumeHalfScreen() {
let time = 300;//(500*this.halfOffset/this.halfHeight).toFixed(0); //回弹动画时间 let time = 300;//(500*this.halfOffset/this.halfHeight).toFixed(0); //回弹动画时间
this.halfNode?.style?.setProperty('transitionDuration', time.toFixed(0)); this.halfNode?.style?.setProperty('transitionDuration', time.toFixed(0)+"ms");
this.halfNode?.style?.setProperty('transitionTimingFunction', 'ease-in-out'); this.halfNode?.style?.setProperty('transitionTimingFunction', 'ease-in-out');
this.halfNode?.style?.setProperty('transitionProperty', 'transform'); this.halfNode?.style?.setProperty('transitionProperty', 'transform');
this.halfNode?.style?.setProperty('transform', 'translateY(0px)'); this.halfNode?.style?.setProperty('transform', 'translateY(0px)');
...@@ -171,7 +171,7 @@ ...@@ -171,7 +171,7 @@
transition-timing-function: ease-in-out; transition-timing-function: ease-in-out;
/*ease ease-in ease-out ease-in-out linear step-start step-end*/ /*ease ease-in ease-out ease-in-out linear step-start step-end*/
transition-property: top; transition-property: top;
transition-duration: 0; transition-duration: 0ms;
visibility: hidden; visibility: hidden;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册