init
This commit is contained in:
103
unpackage/dist/dev/mp-weixin/uni_modules/nutui-uni/components/animate/animate.js
vendored
Normal file
103
unpackage/dist/dev/mp-weixin/uni_modules/nutui-uni/components/animate/animate.js
vendored
Normal file
@@ -0,0 +1,103 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const uni_modules_nutuiUni_components__constants_event = require("../_constants/event.js");
|
||||
const uni_modules_nutuiUni_components__constants_prefix = require("../_constants/prefix.js");
|
||||
require("../_utils/env.js");
|
||||
const uni_modules_nutuiUni_components__utils_raf = require("../_utils/raf.js");
|
||||
const uni_modules_nutuiUni_components__utils_style = require("../_utils/style.js");
|
||||
const uni_modules_nutuiUni_components__utils_props = require("../_utils/props.js");
|
||||
const animateProps = {
|
||||
...uni_modules_nutuiUni_components__utils_props.commonProps,
|
||||
/**
|
||||
* @description 控制动画,当值从 false 变为 true 时会触发一次动画
|
||||
*/
|
||||
show: Boolean,
|
||||
/**
|
||||
* @description 动画类型
|
||||
* @values 'fade', 'slide', 'zoom', ...
|
||||
*/
|
||||
type: uni_modules_nutuiUni_components__utils_props.makeStringProp(""),
|
||||
/**
|
||||
* @description 是否循环执行。`true`-循环执行; `false`-执行一次
|
||||
*/
|
||||
loop: Boolean,
|
||||
/**
|
||||
* @description 动画时长,单位 ms
|
||||
*/
|
||||
duration: uni_modules_nutuiUni_components__utils_props.makeNumericProp(500),
|
||||
/**
|
||||
* @description (不能与 show 同时使用)触发方式,`initial`-初始化执行; `click`-点击执行
|
||||
* @values 'initial', 'click'
|
||||
* @default initial
|
||||
*/
|
||||
action: uni_modules_nutuiUni_components__utils_props.makeStringProp("initial")
|
||||
};
|
||||
const animateEmits = {
|
||||
[uni_modules_nutuiUni_components__constants_event.CLICK_EVENT]: (evt) => evt instanceof Object,
|
||||
animate: () => true
|
||||
};
|
||||
const componentName = `${uni_modules_nutuiUni_components__constants_prefix.PREFIX}-animate`;
|
||||
const __default__ = common_vendor.defineComponent({
|
||||
name: componentName,
|
||||
options: {
|
||||
virtualHost: true,
|
||||
addGlobalClass: true,
|
||||
styleIsolation: "shared"
|
||||
}
|
||||
});
|
||||
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
||||
...__default__,
|
||||
props: animateProps,
|
||||
emits: animateEmits,
|
||||
setup(__props, { emit: __emit }) {
|
||||
const props = __props;
|
||||
const emit = __emit;
|
||||
const animated = common_vendor.ref(props.action === "initial" || props.show === true || props.loop);
|
||||
const classes = common_vendor.computed(() => {
|
||||
const obj = {
|
||||
[`${componentName}__container`]: true,
|
||||
[`${componentName}-${props.type}`]: animated.value,
|
||||
loop: props.loop
|
||||
};
|
||||
return uni_modules_nutuiUni_components__utils_style.getMainClass(props, componentName, obj);
|
||||
});
|
||||
const getStyle = common_vendor.computed(() => {
|
||||
return uni_modules_nutuiUni_components__utils_style.getMainStyle(props, {
|
||||
animationDuration: props.duration ? `${props.duration}ms` : void 0
|
||||
});
|
||||
});
|
||||
function animate() {
|
||||
animated.value = false;
|
||||
uni_modules_nutuiUni_components__utils_raf.requestAniFrame(() => {
|
||||
uni_modules_nutuiUni_components__utils_raf.requestAniFrame(() => {
|
||||
animated.value = true;
|
||||
});
|
||||
});
|
||||
}
|
||||
function handleClick(event) {
|
||||
if (props.action === "click") {
|
||||
animate();
|
||||
emit(uni_modules_nutuiUni_components__constants_event.CLICK_EVENT, event);
|
||||
emit("animate");
|
||||
}
|
||||
}
|
||||
common_vendor.watch(
|
||||
() => props.show,
|
||||
(val) => {
|
||||
if (val) {
|
||||
animate();
|
||||
emit("animate");
|
||||
}
|
||||
}
|
||||
);
|
||||
return (_ctx, _cache) => {
|
||||
return {
|
||||
a: common_vendor.n(classes.value),
|
||||
b: common_vendor.s(getStyle.value),
|
||||
c: common_vendor.o(handleClick)
|
||||
};
|
||||
};
|
||||
}
|
||||
});
|
||||
wx.createComponent(_sfc_main);
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/nutui-uni/components/animate/animate.js.map
|
||||
4
unpackage/dist/dev/mp-weixin/uni_modules/nutui-uni/components/animate/animate.json
vendored
Normal file
4
unpackage/dist/dev/mp-weixin/uni_modules/nutui-uni/components/animate/animate.json
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
1
unpackage/dist/dev/mp-weixin/uni_modules/nutui-uni/components/animate/animate.wxml
vendored
Normal file
1
unpackage/dist/dev/mp-weixin/uni_modules/nutui-uni/components/animate/animate.wxml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<view class="nut-animate"><view class="{{a}}" style="{{b}}" bindtap="{{c}}"><slot/></view></view>
|
||||
284
unpackage/dist/dev/mp-weixin/uni_modules/nutui-uni/components/animate/animate.wxss
vendored
Normal file
284
unpackage/dist/dev/mp-weixin/uni_modules/nutui-uni/components/animate/animate.wxss
vendored
Normal file
@@ -0,0 +1,284 @@
|
||||
/**
|
||||
* 这里是uni-app内置的常用样式变量
|
||||
*
|
||||
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
|
||||
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
|
||||
*
|
||||
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
|
||||
*/
|
||||
/* 颜色变量 */
|
||||
/* 行为相关颜色 */
|
||||
/* 文字基本颜色 */
|
||||
/* 背景颜色 */
|
||||
/* 边框颜色 */
|
||||
/* 尺寸变量 */
|
||||
/* 文字尺寸 */
|
||||
/* 图片尺寸 */
|
||||
/* Border Radius */
|
||||
/* 水平间距 */
|
||||
/* 垂直间距 */
|
||||
/* 透明度 */
|
||||
/* 文章场景相关 */
|
||||
/**
|
||||
* 这里是uni-app内置的常用样式变量
|
||||
*
|
||||
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
|
||||
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
|
||||
*
|
||||
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
|
||||
*/
|
||||
/* 颜色变量 */
|
||||
/* 行为相关颜色 */
|
||||
/* 文字基本颜色 */
|
||||
/* 背景颜色 */
|
||||
/* 边框颜色 */
|
||||
/* 尺寸变量 */
|
||||
/* 文字尺寸 */
|
||||
/* 图片尺寸 */
|
||||
/* Border Radius */
|
||||
/* 水平间距 */
|
||||
/* 垂直间距 */
|
||||
/* 透明度 */
|
||||
/* 文章场景相关 */
|
||||
.nut-animate {
|
||||
/* Animation css */
|
||||
}
|
||||
.nut-animate .nut-animate__container {
|
||||
display: inline-block;
|
||||
}
|
||||
.nut-animate [class*=nut-animate-] {
|
||||
animation-duration: 0.5s;
|
||||
animation-timing-function: ease-out;
|
||||
animation-fill-mode: both;
|
||||
}
|
||||
.nut-animate .nut-animate-shake {
|
||||
animation-name: shake;
|
||||
}
|
||||
.nut-animate .nut-animate-ripple {
|
||||
animation-name: ripple;
|
||||
}
|
||||
.nut-animate .nut-animate-float {
|
||||
position: relative;
|
||||
animation-name: float-pop;
|
||||
}
|
||||
.nut-animate .nut-animate-breath {
|
||||
animation-name: breath;
|
||||
animation-duration: 2700ms;
|
||||
animation-timing-function: ease-in-out;
|
||||
animation-direction: alternate;
|
||||
}
|
||||
.nut-animate .nut-animate-slide-right {
|
||||
animation-name: slide-right;
|
||||
}
|
||||
.nut-animate .nut-animate-slide-left {
|
||||
animation-name: slide-left;
|
||||
}
|
||||
.nut-animate .nut-animate-slide-top {
|
||||
animation-name: slide-top;
|
||||
}
|
||||
.nut-animate .nut-animate-slide-bottom {
|
||||
animation-name: slide-bottom;
|
||||
}
|
||||
.nut-animate .nut-animate-jump {
|
||||
transform-origin: center center;
|
||||
animation: jump 0.7s linear;
|
||||
}
|
||||
.nut-animate .loop {
|
||||
animation-iteration-count: infinite;
|
||||
}
|
||||
@keyframes shake {
|
||||
0%, 100% {
|
||||
transform: translateX(0);
|
||||
}
|
||||
10% {
|
||||
transform: translateX(-9px);
|
||||
}
|
||||
20% {
|
||||
transform: translateX(8px);
|
||||
}
|
||||
30% {
|
||||
transform: translateX(-7px);
|
||||
}
|
||||
40% {
|
||||
transform: translateX(6px);
|
||||
}
|
||||
50% {
|
||||
transform: translateX(-5px);
|
||||
}
|
||||
60% {
|
||||
transform: translateX(4px);
|
||||
}
|
||||
70% {
|
||||
transform: translateX(-3px);
|
||||
}
|
||||
80% {
|
||||
transform: translateX(2px);
|
||||
}
|
||||
90% {
|
||||
transform: translateX(-1px);
|
||||
}
|
||||
}
|
||||
@keyframes ripple {
|
||||
0% {
|
||||
transform: scale(1);
|
||||
}
|
||||
50% {
|
||||
transform: scale(1.1);
|
||||
}
|
||||
}
|
||||
@keyframes breath {
|
||||
0% {
|
||||
transform: scale(1);
|
||||
}
|
||||
50% {
|
||||
transform: scale(1.1);
|
||||
}
|
||||
100% {
|
||||
transform: scale(1);
|
||||
}
|
||||
}
|
||||
@keyframes slide-right {
|
||||
0% {
|
||||
opacity: 0;
|
||||
transform: translateX(100%);
|
||||
}
|
||||
100% {
|
||||
opacity: 1;
|
||||
transform: translateX(0);
|
||||
}
|
||||
}
|
||||
@keyframes slide-left {
|
||||
0% {
|
||||
opacity: 0;
|
||||
transform: translateX(-100%);
|
||||
}
|
||||
100% {
|
||||
opacity: 1;
|
||||
transform: translateX(0);
|
||||
}
|
||||
}
|
||||
@keyframes slide-top {
|
||||
0% {
|
||||
opacity: 0;
|
||||
transform: translateY(-100%);
|
||||
}
|
||||
100% {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
@keyframes slide-bottom {
|
||||
0% {
|
||||
opacity: 0;
|
||||
transform: translateY(100%);
|
||||
}
|
||||
100% {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
@keyframes float-pop {
|
||||
0% {
|
||||
top: 0;
|
||||
}
|
||||
25% {
|
||||
top: 1px;
|
||||
}
|
||||
50% {
|
||||
top: 4px;
|
||||
}
|
||||
75% {
|
||||
top: 1px;
|
||||
}
|
||||
100% {
|
||||
top: 0;
|
||||
}
|
||||
}
|
||||
@keyframes jump {
|
||||
0% {
|
||||
transform: rotate(0deg) translateY(0);
|
||||
animation-timing-function: ease-in;
|
||||
}
|
||||
25% {
|
||||
transform: rotate(10deg) translateY(20px);
|
||||
animation-timing-function: ease-out;
|
||||
}
|
||||
50% {
|
||||
transform: rotate(0deg) translateY(-10px);
|
||||
animation-timing-function: ease-in;
|
||||
}
|
||||
75% {
|
||||
transform: rotate(-10deg) translateY(20px);
|
||||
animation-timing-function: ease-out;
|
||||
}
|
||||
100% {
|
||||
transform: rotate(0deg) translateY(0);
|
||||
animation-timing-function: ease-in;
|
||||
}
|
||||
}
|
||||
.nut-animate .nut-animate-twinkle {
|
||||
position: relative;
|
||||
}
|
||||
.nut-animate .nut-animate-twinkle::after, .nut-animate .nut-animate-twinkle::before {
|
||||
position: absolute;
|
||||
right: 50%;
|
||||
z-index: 1;
|
||||
box-sizing: border-box;
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
margin-top: -15px;
|
||||
margin-right: -30px;
|
||||
content: "";
|
||||
border: 4px solid rgba(255, 255, 255, 0.6);
|
||||
border-radius: 30px;
|
||||
transform: scale(0);
|
||||
animation: twinkle 2s ease-out infinite;
|
||||
}
|
||||
.nut-animate .nut-animate-twinkle::after {
|
||||
animation-delay: 0.4s;
|
||||
}
|
||||
@keyframes twinkle {
|
||||
0% {
|
||||
transform: scale(0);
|
||||
}
|
||||
20% {
|
||||
opacity: 1;
|
||||
}
|
||||
50%, 100% {
|
||||
opacity: 0;
|
||||
transform: scale(1.4);
|
||||
}
|
||||
}
|
||||
.nut-animate .nut-animate-flicker {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
.nut-animate .nut-animate-flicker::after {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100px;
|
||||
height: 60px;
|
||||
content: "";
|
||||
background-image: linear-gradient(106deg, rgba(232, 224, 255, 0) 24%, #e8e0ff 91%);
|
||||
filter: blur(3px);
|
||||
opacity: 0.73;
|
||||
transform: skewX(-20deg);
|
||||
animation: flicker 1.5s linear infinite;
|
||||
}
|
||||
@keyframes flicker {
|
||||
0% {
|
||||
transform: translateX(-100px) skewX(-20deg);
|
||||
}
|
||||
40%, 100% {
|
||||
transform: translateX(150px) skewX(-20deg);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user