Houjie
2025-04-11 1bf977929dd324f3ac64b70debd8a79443c54392
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
<template>
    <view>
        <cu-custom bgImage="https://image.weilanwl.com/color2.0/plugin/wdh2236.jpg" :isBack="true"><block slot="backText">返回</block>
            <block slot="content">微动画</block>
        </cu-custom>
        <view class="cu-bar bg-white">
            <view class="action">
                <text class="cuIcon-title text-orange"></text> 默认效果
            </view>
        </view>
        <view class="padding-sm">
            <view class="flex flex-wrap justify-around">
                <button class="cu-btn margin-sm basis-sm shadow" :class="['bg-' + item.color,animation==item.name?'animation-' +item.name :'']"
                 @tap="Toggle" :data-class="item.name" v-for="(item,index) in list" :key="index">{{item.name}}</button>
            </view>
        </view>
        <view class="cu-bar bg-white">
            <view class="action">
                <text class="cuIcon-title text-orange"></text> 反向动画
            </view>
        </view>
 
        <view class="padding-sm">
            <view class="flex flex-wrap justify-around">
                <button class="cu-btn animation-reverse margin-sm basis-sm shadow" :class="['bg-' + item.color,animation==item.name+'s'?'animation-' +item.name:'']"
                 @tap="Toggle" :data-class="item.name+'s'" v-for="(item,index) in list" :key="index">{{item.name}}</button>
            </view>
        </view>
        <view class="cu-bar bg-white">
            <view class="action">
                <text class="cuIcon-title text-orange"></text> 延迟执行
            </view>
            <view class="action">
                <button class="cu-btn bg-cyan shadow" @tap="ToggleDelay">开始执行</button>
            </view>
        </view>
 
        <view class="padding-sm">
            <view class="flex flex-wrap justify-around">
                <button class="margin-sm basis-sm shadow cu-btn" :class="['bg-' + item.color,toggleDelay?'animation-slide-bottom':'']"
                 :style="[{animationDelay: (index + 1)*0.1 + 's'}]" v-for="(item,index) in list" :key="index">0.{{index+1}}s</button>
            </view>
        </view>
        <view class="cu-bar bg-white">
            <view class="action">
                <text class="cuIcon-title text-orange"></text> Gif动画
            </view>
        </view>
        <view class="margin radius bg-gradual-green shadow-blur">
            <image src="https://image.weilanwl.com/gif/wave.gif" mode="scaleToFill" class="gif-black response" style="height:100upx"></image>
        </view>
        <view class="margin flex">
            <view class="bg-black flex-sub margin-right radius shadow-lg">
                <image src="https://image.weilanwl.com/gif/loading-black.gif" mode="aspectFit" class="gif-black response" style="height:240upx"></image>
            </view>
            <view class="bg-white flex-sub radius shadow-lg">
                <image src="https://image.weilanwl.com/gif/loading-white.gif" mode="aspectFit" class="gif-white response" style="height:240upx"></image>
            </view>
        </view>
        <view class="margin flex">
            <view class="bg-gradual-blue flex-sub margin-right radius shadow-lg">
                <image src="https://image.weilanwl.com/gif/rhomb-black.gif" mode="aspectFit" class="gif-black response" style="height:240upx"></image>
            </view>
            <view class="bg-white flex-sub radius shadow-lg">
                <image src="https://image.weilanwl.com/gif/rhomb-white.gif" mode="aspectFit" class="gif-white response" style="height:240upx"></image>
            </view>
        </view>
        <view class="margin flex">
            <view class="bg-white flex-sub margin-right radius shadow-lg">
                <image src="https://image.weilanwl.com/gif/loading-1.gif" mode="aspectFit" class="gif-white response" style="height:240upx"></image>
            </view>
            <view class="bg-black flex-sub radius shadow-lg">
                <image src="https://image.weilanwl.com/gif/loading-2.gif" mode="aspectFit" class="gif-black response" style="height:240upx"></image>
            </view>
        </view>
    </view>
</template>
 
<script>
    export default {
        data() {
            return {
                animation:'',
                list: [{
                        name: 'fade',
                        color: 'red'
                    },
                    {
                        name: 'scale-up',
                        color: 'orange'
                    },
                    {
                        name: 'scale-down',
                        color: 'olive'
                    },
                    {
                        name: 'slide-top',
                        color: 'green'
                    }, {
                        name: 'slide-bottom',
                        color: 'cyan'
                    },
                    {
                        name: 'slide-left',
                        color: 'blue'
                    },
                    {
                        name: 'slide-right',
                        color: 'purple'
                    },
                    {
                        name: 'shake',
                        color: 'mauve'
                    }
                ],
                toggleDelay: false
 
            };
        },
        methods: {
            Toggle(e) {
                var anmiaton = e.currentTarget.dataset.class;
                this.animation= anmiaton;
                setTimeout(()=>{
                    this.animation= '';
                }, 1000)
            },
            ToggleDelay() {
                this.toggleDelay= true;
                setTimeout(()=>{
                    this.toggleDelay= false
                }, 1000)
            }
        },
    }
</script>
 
<style>
    @import "/plugin/colorui/animation.css";
    
    image[class*="gif-"] {
        border-radius: 6upx;
        display: block;
    }
</style>