@leafer-in/transition 2.3.0 → 2.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/transition.cjs +83 -0
- package/dist/transition.esm.js +81 -0
- package/dist/transition.esm.min.js +2 -0
- package/dist/transition.esm.min.js.map +1 -0
- package/dist/transition.js +76 -0
- package/dist/transition.min.cjs +2 -0
- package/dist/transition.min.cjs.map +1 -0
- package/dist/transition.min.js +2 -0
- package/dist/transition.min.js.map +1 -0
- package/package.json +6 -6
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var draw = require("@leafer-ui/draw");
|
|
4
|
+
|
|
5
|
+
const AnimatePaint = {
|
|
6
|
+
paintTransition(from, to, t, ui) {
|
|
7
|
+
if (draw.isString(from) && draw.isString(to)) {
|
|
8
|
+
return draw.Transition.color(from, to, t);
|
|
9
|
+
} else if (draw.isObject(from) && draw.isObject(to)) {
|
|
10
|
+
return AnimatePaint.gradient(from, to, t, ui);
|
|
11
|
+
} else {
|
|
12
|
+
return to;
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
gradient(from, to, t, ui) {
|
|
16
|
+
const paint = Object.assign({}, to);
|
|
17
|
+
paint.from = gradientPoint("from", from, to, t, ui);
|
|
18
|
+
paint.to = gradientPoint("to", from, to, t, ui);
|
|
19
|
+
paint.stops = AnimatePaint.stops(from.stops, to.stops, t);
|
|
20
|
+
if (from.opacity || to.opacity) paint.opacity = draw.Transition.number(from.opacity || 1, to.opacity || 1, t);
|
|
21
|
+
if (from.rotation || to.rotation) paint.rotation = draw.Transition.number(from.rotation || 0, to.rotation || 0, t);
|
|
22
|
+
if (from.stretch || to.stretch) paint.stretch = draw.Transition.number(from.stretch || 1, to.stretch || 1, t);
|
|
23
|
+
return paint;
|
|
24
|
+
},
|
|
25
|
+
stops(from, to, t) {
|
|
26
|
+
const fromStr = draw.isString(from[0]), toStr = draw.isString(to[0]);
|
|
27
|
+
if (from.length === to.length && fromStr && toStr) return from.map((color, index) => draw.Transition.color(color, to[index], t));
|
|
28
|
+
if (fromStr) from = toStops(from);
|
|
29
|
+
if (toStr) to = toStops(to);
|
|
30
|
+
if (from.length < to.length) from = fixStops(from, to.length); else if (to.length < from.length) to = fixStops(to, from.length);
|
|
31
|
+
return from.map((stop, index) => ({
|
|
32
|
+
offset: draw.Transition.number(stop.offset, to[index].offset, t),
|
|
33
|
+
color: draw.Transition.color(stop.color, to[index].color, t)
|
|
34
|
+
}));
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
function fixStops(stops, len) {
|
|
39
|
+
const add = len - stops.length, newStops = [];
|
|
40
|
+
for (let i = 0; i < stops.length; i++) {
|
|
41
|
+
newStops.push(stops[i]);
|
|
42
|
+
if (i < add) newStops.push(stops[i]);
|
|
43
|
+
}
|
|
44
|
+
return newStops;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function toStops(stops) {
|
|
48
|
+
const {length: length} = stops;
|
|
49
|
+
return stops.map((color, index) => ({
|
|
50
|
+
offset: index / (length - 1),
|
|
51
|
+
color: color
|
|
52
|
+
}));
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function gradientPoint(fromTo, a, b, t, ui) {
|
|
56
|
+
if (a[fromTo] === b[fromTo]) return a[fromTo];
|
|
57
|
+
let from = toGradientPoint(a.type, fromTo, a[fromTo]);
|
|
58
|
+
let to = toGradientPoint(b.type, fromTo, b[fromTo]);
|
|
59
|
+
if (from.type !== to.type) {
|
|
60
|
+
const {boxBounds: boxBounds} = ui.__layout;
|
|
61
|
+
if (from.type !== "px") from = Object.assign(Object.assign({}, from), {
|
|
62
|
+
type: "px"
|
|
63
|
+
}), draw.AroundHelper.toPoint(from, boxBounds, from);
|
|
64
|
+
if (to.type !== "px") to = Object.assign({}, to), draw.AroundHelper.toPoint(to, boxBounds, to);
|
|
65
|
+
}
|
|
66
|
+
return {
|
|
67
|
+
type: from.type,
|
|
68
|
+
x: draw.Transition.number(from.x, to.x, t),
|
|
69
|
+
y: draw.Transition.number(from.y, to.y, t)
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function toGradientPoint(type, fromTo, point) {
|
|
74
|
+
if (!point) point = type === "linear" ? fromTo === "from" ? "top" : "bottom" : fromTo === "from" ? "center" : "bottom";
|
|
75
|
+
return draw.isObject(point) ? point : draw.AroundHelper.get(point);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const TransitionList = {
|
|
79
|
+
fill: AnimatePaint.paintTransition,
|
|
80
|
+
stroke: AnimatePaint.paintTransition
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
Object.assign(draw.Transition.list, TransitionList);
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { isString, Transition, isObject, AroundHelper } from "@leafer-ui/draw";
|
|
2
|
+
|
|
3
|
+
const AnimatePaint = {
|
|
4
|
+
paintTransition(from, to, t, ui) {
|
|
5
|
+
if (isString(from) && isString(to)) {
|
|
6
|
+
return Transition.color(from, to, t);
|
|
7
|
+
} else if (isObject(from) && isObject(to)) {
|
|
8
|
+
return AnimatePaint.gradient(from, to, t, ui);
|
|
9
|
+
} else {
|
|
10
|
+
return to;
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
gradient(from, to, t, ui) {
|
|
14
|
+
const paint = Object.assign({}, to);
|
|
15
|
+
paint.from = gradientPoint("from", from, to, t, ui);
|
|
16
|
+
paint.to = gradientPoint("to", from, to, t, ui);
|
|
17
|
+
paint.stops = AnimatePaint.stops(from.stops, to.stops, t);
|
|
18
|
+
if (from.opacity || to.opacity) paint.opacity = Transition.number(from.opacity || 1, to.opacity || 1, t);
|
|
19
|
+
if (from.rotation || to.rotation) paint.rotation = Transition.number(from.rotation || 0, to.rotation || 0, t);
|
|
20
|
+
if (from.stretch || to.stretch) paint.stretch = Transition.number(from.stretch || 1, to.stretch || 1, t);
|
|
21
|
+
return paint;
|
|
22
|
+
},
|
|
23
|
+
stops(from, to, t) {
|
|
24
|
+
const fromStr = isString(from[0]), toStr = isString(to[0]);
|
|
25
|
+
if (from.length === to.length && fromStr && toStr) return from.map((color, index) => Transition.color(color, to[index], t));
|
|
26
|
+
if (fromStr) from = toStops(from);
|
|
27
|
+
if (toStr) to = toStops(to);
|
|
28
|
+
if (from.length < to.length) from = fixStops(from, to.length); else if (to.length < from.length) to = fixStops(to, from.length);
|
|
29
|
+
return from.map((stop, index) => ({
|
|
30
|
+
offset: Transition.number(stop.offset, to[index].offset, t),
|
|
31
|
+
color: Transition.color(stop.color, to[index].color, t)
|
|
32
|
+
}));
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
function fixStops(stops, len) {
|
|
37
|
+
const add = len - stops.length, newStops = [];
|
|
38
|
+
for (let i = 0; i < stops.length; i++) {
|
|
39
|
+
newStops.push(stops[i]);
|
|
40
|
+
if (i < add) newStops.push(stops[i]);
|
|
41
|
+
}
|
|
42
|
+
return newStops;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function toStops(stops) {
|
|
46
|
+
const {length: length} = stops;
|
|
47
|
+
return stops.map((color, index) => ({
|
|
48
|
+
offset: index / (length - 1),
|
|
49
|
+
color: color
|
|
50
|
+
}));
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function gradientPoint(fromTo, a, b, t, ui) {
|
|
54
|
+
if (a[fromTo] === b[fromTo]) return a[fromTo];
|
|
55
|
+
let from = toGradientPoint(a.type, fromTo, a[fromTo]);
|
|
56
|
+
let to = toGradientPoint(b.type, fromTo, b[fromTo]);
|
|
57
|
+
if (from.type !== to.type) {
|
|
58
|
+
const {boxBounds: boxBounds} = ui.__layout;
|
|
59
|
+
if (from.type !== "px") from = Object.assign(Object.assign({}, from), {
|
|
60
|
+
type: "px"
|
|
61
|
+
}), AroundHelper.toPoint(from, boxBounds, from);
|
|
62
|
+
if (to.type !== "px") to = Object.assign({}, to), AroundHelper.toPoint(to, boxBounds, to);
|
|
63
|
+
}
|
|
64
|
+
return {
|
|
65
|
+
type: from.type,
|
|
66
|
+
x: Transition.number(from.x, to.x, t),
|
|
67
|
+
y: Transition.number(from.y, to.y, t)
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function toGradientPoint(type, fromTo, point) {
|
|
72
|
+
if (!point) point = type === "linear" ? fromTo === "from" ? "top" : "bottom" : fromTo === "from" ? "center" : "bottom";
|
|
73
|
+
return isObject(point) ? point : AroundHelper.get(point);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const TransitionList = {
|
|
77
|
+
fill: AnimatePaint.paintTransition,
|
|
78
|
+
stroke: AnimatePaint.paintTransition
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
Object.assign(Transition.list, TransitionList);
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{isString as t,Transition as o,isObject as n,AroundHelper as e}from"@leafer-ui/draw";const r={paintTransition:(e,s,i,c)=>t(e)&&t(s)?o.color(e,s,i):n(e)&&n(s)?r.gradient(e,s,i,c):s,gradient(t,n,e,s){const i=Object.assign({},n);return i.from=c("from",t,n,e,s),i.to=c("to",t,n,e,s),i.stops=r.stops(t.stops,n.stops,e),(t.opacity||n.opacity)&&(i.opacity=o.number(t.opacity||1,n.opacity||1,e)),(t.rotation||n.rotation)&&(i.rotation=o.number(t.rotation||0,n.rotation||0,e)),(t.stretch||n.stretch)&&(i.stretch=o.number(t.stretch||1,n.stretch||1,e)),i},stops(n,e,r){const c=t(n[0]),p=t(e[0]);return n.length===e.length&&c&&p?n.map((t,n)=>o.color(t,e[n],r)):(c&&(n=i(n)),p&&(e=i(e)),n.length<e.length?n=s(n,e.length):e.length<n.length&&(e=s(e,n.length)),n.map((t,n)=>({offset:o.number(t.offset,e[n].offset,r),color:o.color(t.color,e[n].color,r)})))}};function s(t,o){const n=o-t.length,e=[];for(let o=0;o<t.length;o++)e.push(t[o]),o<n&&e.push(t[o]);return e}function i(t){const{length:o}=t;return t.map((t,n)=>({offset:n/(o-1),color:t}))}function c(t,n,r,s,i){if(n[t]===r[t])return n[t];let c=p(n.type,t,n[t]),a=p(r.type,t,r[t]);if(c.type!==a.type){const{boxBounds:t}=i.__layout;"px"!==c.type&&(c=Object.assign(Object.assign({},c),{type:"px"}),e.toPoint(c,t,c)),"px"!==a.type&&(a=Object.assign({},a),e.toPoint(a,t,a))}return{type:c.type,x:o.number(c.x,a.x,s),y:o.number(c.y,a.y,s)}}function p(t,o,r){return r||(r="linear"===t?"from"===o?"top":"bottom":"from"===o?"center":"bottom"),n(r)?r:e.get(r)}const a={fill:r.paintTransition,stroke:r.paintTransition};Object.assign(o.list,a);
|
|
2
|
+
//# sourceMappingURL=transition.esm.min.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transition.esm.min.js","sources":["../../../../../../src/in/packages/transition/src/AnimatePaint.ts","../../../../../../src/in/packages/transition/src/Transition.ts","../../../../../../src/in/packages/transition/src/index.ts"],"sourcesContent":["import { IPaint, IPaintString, IGradientPaint, IUI, IUnitPointData, IAlign, IGradientType, IColorStop, IColorString } from '@leafer-ui/interface'\nimport { AroundHelper, Transition, isObject, isString } from '@leafer-ui/draw'\n\n\nexport const AnimatePaint = {\n\n paintTransition(from: IPaint | IPaint[] | IPaintString, to: IPaint | IPaint[] | IPaintString, t: number, ui: IUI) {\n if (isString(from) && isString(to)) {\n return Transition.color(from, to, t)\n } else if (isObject(from) && isObject(to)) {\n return AnimatePaint.gradient(from as any, to as any, t, ui)\n } else {\n return to\n }\n },\n\n gradient(from: IGradientPaint, to: IGradientPaint, t: number, ui: IUI): IGradientPaint {\n const paint: IGradientPaint = { ...to }\n paint.from = gradientPoint('from', from, to, t, ui)\n paint.to = gradientPoint('to', from, to, t, ui)\n paint.stops = AnimatePaint.stops(from.stops, to.stops, t)\n if (from.opacity || to.opacity) paint.opacity = Transition.number(from.opacity || 1, to.opacity || 1, t)\n if (from.rotation || to.rotation) paint.rotation = Transition.number(from.rotation || 0, to.rotation || 0, t)\n if (from.stretch || to.stretch) paint.stretch = Transition.number(from.stretch || 1, to.stretch || 1, t)\n return paint\n },\n\n stops(from: IColorStop[] | IColorString[], to: IColorStop[] | IColorString[], t: number): IColorStop[] | IColorString[] {\n const fromStr = isString(from[0]), toStr = isString(to[0])\n if (from.length === to.length && fromStr && toStr) return from.map((color, index) => Transition.color(color as string, to[index] as string, t))\n\n if (fromStr) from = toStops(from as IColorString[])\n if (toStr) to = toStops(to as IColorString[])\n\n if (from.length < to.length) from = fixStops(from as IColorStop[], to.length)\n else if (to.length < from.length) to = fixStops(to as IColorStop[], from.length)\n\n return from.map((stop, index) => {\n return {\n offset: Transition.number((stop as IColorStop).offset, (to[index] as IColorStop).offset, t),\n color: Transition.color((stop as IColorStop).color, (to[index] as IColorStop).color, t)\n }\n })\n }\n\n}\n\n\nfunction fixStops(stops: IColorStop[], len: number): IColorStop[] {\n const add = len - stops.length, newStops = []\n for (let i = 0; i < stops.length; i++) {\n newStops.push(stops[i])\n if (i < add) newStops.push(stops[i])\n }\n return newStops\n}\n\nfunction toStops(stops: IColorString[]): IColorStop[] {\n const { length } = stops\n return stops.map((color, index) => { return { offset: index / (length - 1), color } }) as IColorStop[]\n}\n\nfunction gradientPoint(fromTo: 'from' | 'to', a: IGradientPaint, b: IGradientPaint, t: number, ui: IUI): IUnitPointData | IAlign {\n if (a[fromTo] === b[fromTo]) return a[fromTo]\n\n let from = toGradientPoint(a.type, fromTo, a[fromTo])\n let to = toGradientPoint(b.type, fromTo, b[fromTo])\n\n if (from.type !== to.type) {\n const { boxBounds } = ui.__layout\n if (from.type !== 'px') from = { ...from, type: 'px' }, AroundHelper.toPoint(from, boxBounds, from)\n if (to.type !== 'px') to = { ...to }, AroundHelper.toPoint(to, boxBounds, to)\n }\n\n return {\n type: from.type,\n x: Transition.number(from.x, to.x, t),\n y: Transition.number(from.y, to.y, t)\n }\n}\n\nfunction toGradientPoint(type: IGradientType, fromTo: 'from' | 'to', point: IUnitPointData | IAlign): IUnitPointData {\n if (!point) point = type === 'linear' ? (fromTo === 'from' ? 'top' : 'bottom') : (fromTo === 'from' ? 'center' : 'bottom')\n return isObject(point) ? point : AroundHelper.get(point)\n}","import { AnimatePaint } from './AnimatePaint'\n\n\nexport const TransitionList = {\n\n fill: AnimatePaint.paintTransition,\n\n stroke: AnimatePaint.paintTransition,\n\n}","import { Transition } from '@leafer-ui/draw'\n\nimport { TransitionList } from './Transition'\n\nObject.assign(Transition.list, TransitionList)"],"names":["AnimatePaint","paintTransition","from","to","t","ui","isString","Transition","color","isObject","gradient","paint","Object","assign","gradientPoint","stops","opacity","number","rotation","stretch","fromStr","toStr","length","map","index","toStops","fixStops","stop","offset","len","add","newStops","i","push","fromTo","a","b","toGradientPoint","type","boxBounds","__layout","AroundHelper","toPoint","x","y","point","get","TransitionList","fill","stroke","list"],"mappings":"2FAIO,MAAMA,EAAe,CAExBC,gBAAe,CAACC,EAAwCC,EAAsCC,EAAWC,IACjGC,EAASJ,IAASI,EAASH,GACpBI,EAAWC,MAAMN,EAAMC,EAAIC,GAC3BK,EAASP,IAASO,EAASN,GAC3BH,EAAaU,SAASR,EAAaC,EAAWC,EAAGC,GAEjDF,EAIf,QAAAO,CAASR,EAAsBC,EAAoBC,EAAWC,GAC1D,MAAMM,EAAKC,OAAAC,OAAA,CAAA,EAAwBV,GAOnC,OANAQ,EAAMT,KAAOY,EAAc,OAAQZ,EAAMC,EAAIC,EAAGC,GAChDM,EAAMR,GAAKW,EAAc,KAAMZ,EAAMC,EAAIC,EAAGC,GAC5CM,EAAMI,MAAQf,EAAae,MAAMb,EAAKa,MAAOZ,EAAGY,MAAOX,IACnDF,EAAKc,SAAWb,EAAGa,WAASL,EAAMK,QAAUT,EAAWU,OAAOf,EAAKc,SAAW,EAAGb,EAAGa,SAAW,EAAGZ,KAClGF,EAAKgB,UAAYf,EAAGe,YAAUP,EAAMO,SAAWX,EAAWU,OAAOf,EAAKgB,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AAI8B,EAAED,KAAYE,EAAEF,GAAS,OAAOC,EAAED,GAEtC,IAAIhC,EAAOmC,EAAgBF,EAAEG,KAAMJ,EAAQC,EAAED,IACzC/B,EAAKkC,EAAgBD,EAAEE,KAAMJ,EAAQE,EAAEF,IAE3C,GAAIhC,EAAKoC,OAASnC,EAAGmC,KAAM,CACvB,MAAMC,UAAEA,GAAclC,EAAGmC,SACP,OAAdtC,EAAKoC,OAAepC,iCAAYA,GAAI,CAAEoC,KAAM,OAAQG,EAAaC,QAAQxC,EAAMqC,EAAWrC,IAC9E,OAAZC,EAAGmC,OAAenC,EAAES,OAAAC,OAAA,CAAA,EAAQV,GAAMsC,EAAaC,QAAQvC,EAAIoC,EAAWpC,GAC9E,CAEA,MAAO,CACHmC,KAAMpC,EAAKoC,KACXK,EAAGpC,EAAWU,OAAOf,EAAKyC,EAAGxC,EAAGwC,EAAGvC,GACnCwC,EAAGrC,EAAWU,OAAOf,EAAK0C,EAAGzC,EAAGyC,EAAGxC,GAE3C,CAEA,SAASiC,EAAgBC,EAAqBJ,EAAuBW,GAEjE,OADKA,IAAOA,EAAiB,WAATP,EAAgC,SAAXJ,EAAoB,MAAQ,SAAwB,SAAXA,EAAoB,SAAW,UAC1GzB,EAASoC,GAASA,EAAQJ,EAAaK,IAAID,EACtD,CCjFO,MAAME,EAAiB,CAE1BC,KAAMhD,EAAaC,gBAEnBgD,OAAQjD,EAAaC,iBCHzBW,OAAOC,OAAON,EAAW2C,KAAMH"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
(function(draw) {
|
|
2
|
+
"use strict";
|
|
3
|
+
const AnimatePaint = {
|
|
4
|
+
paintTransition(from, to, t, ui) {
|
|
5
|
+
if (draw.isString(from) && draw.isString(to)) {
|
|
6
|
+
return draw.Transition.color(from, to, t);
|
|
7
|
+
} else if (draw.isObject(from) && draw.isObject(to)) {
|
|
8
|
+
return AnimatePaint.gradient(from, to, t, ui);
|
|
9
|
+
} else {
|
|
10
|
+
return to;
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
gradient(from, to, t, ui) {
|
|
14
|
+
const paint = Object.assign({}, to);
|
|
15
|
+
paint.from = gradientPoint("from", from, to, t, ui);
|
|
16
|
+
paint.to = gradientPoint("to", from, to, t, ui);
|
|
17
|
+
paint.stops = AnimatePaint.stops(from.stops, to.stops, t);
|
|
18
|
+
if (from.opacity || to.opacity) paint.opacity = draw.Transition.number(from.opacity || 1, to.opacity || 1, t);
|
|
19
|
+
if (from.rotation || to.rotation) paint.rotation = draw.Transition.number(from.rotation || 0, to.rotation || 0, t);
|
|
20
|
+
if (from.stretch || to.stretch) paint.stretch = draw.Transition.number(from.stretch || 1, to.stretch || 1, t);
|
|
21
|
+
return paint;
|
|
22
|
+
},
|
|
23
|
+
stops(from, to, t) {
|
|
24
|
+
const fromStr = draw.isString(from[0]), toStr = draw.isString(to[0]);
|
|
25
|
+
if (from.length === to.length && fromStr && toStr) return from.map((color, index) => draw.Transition.color(color, to[index], t));
|
|
26
|
+
if (fromStr) from = toStops(from);
|
|
27
|
+
if (toStr) to = toStops(to);
|
|
28
|
+
if (from.length < to.length) from = fixStops(from, to.length); else if (to.length < from.length) to = fixStops(to, from.length);
|
|
29
|
+
return from.map((stop, index) => ({
|
|
30
|
+
offset: draw.Transition.number(stop.offset, to[index].offset, t),
|
|
31
|
+
color: draw.Transition.color(stop.color, to[index].color, t)
|
|
32
|
+
}));
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
function fixStops(stops, len) {
|
|
36
|
+
const add = len - stops.length, newStops = [];
|
|
37
|
+
for (let i = 0; i < stops.length; i++) {
|
|
38
|
+
newStops.push(stops[i]);
|
|
39
|
+
if (i < add) newStops.push(stops[i]);
|
|
40
|
+
}
|
|
41
|
+
return newStops;
|
|
42
|
+
}
|
|
43
|
+
function toStops(stops) {
|
|
44
|
+
const {length: length} = stops;
|
|
45
|
+
return stops.map((color, index) => ({
|
|
46
|
+
offset: index / (length - 1),
|
|
47
|
+
color: color
|
|
48
|
+
}));
|
|
49
|
+
}
|
|
50
|
+
function gradientPoint(fromTo, a, b, t, ui) {
|
|
51
|
+
if (a[fromTo] === b[fromTo]) return a[fromTo];
|
|
52
|
+
let from = toGradientPoint(a.type, fromTo, a[fromTo]);
|
|
53
|
+
let to = toGradientPoint(b.type, fromTo, b[fromTo]);
|
|
54
|
+
if (from.type !== to.type) {
|
|
55
|
+
const {boxBounds: boxBounds} = ui.__layout;
|
|
56
|
+
if (from.type !== "px") from = Object.assign(Object.assign({}, from), {
|
|
57
|
+
type: "px"
|
|
58
|
+
}), draw.AroundHelper.toPoint(from, boxBounds, from);
|
|
59
|
+
if (to.type !== "px") to = Object.assign({}, to), draw.AroundHelper.toPoint(to, boxBounds, to);
|
|
60
|
+
}
|
|
61
|
+
return {
|
|
62
|
+
type: from.type,
|
|
63
|
+
x: draw.Transition.number(from.x, to.x, t),
|
|
64
|
+
y: draw.Transition.number(from.y, to.y, t)
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
function toGradientPoint(type, fromTo, point) {
|
|
68
|
+
if (!point) point = type === "linear" ? fromTo === "from" ? "top" : "bottom" : fromTo === "from" ? "center" : "bottom";
|
|
69
|
+
return draw.isObject(point) ? point : draw.AroundHelper.get(point);
|
|
70
|
+
}
|
|
71
|
+
const TransitionList = {
|
|
72
|
+
fill: AnimatePaint.paintTransition,
|
|
73
|
+
stroke: AnimatePaint.paintTransition
|
|
74
|
+
};
|
|
75
|
+
Object.assign(draw.Transition.list, TransitionList);
|
|
76
|
+
})(LeaferUI);
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var t=require("@leafer-ui/draw");const n={paintTransition:(o,r,i,e)=>t.isString(o)&&t.isString(r)?t.Transition.color(o,r,i):t.isObject(o)&&t.isObject(r)?n.gradient(o,r,i,e):r,gradient(o,r,e,s){const a=Object.assign({},r);return a.from=i("from",o,r,e,s),a.to=i("to",o,r,e,s),a.stops=n.stops(o.stops,r.stops,e),(o.opacity||r.opacity)&&(a.opacity=t.Transition.number(o.opacity||1,r.opacity||1,e)),(o.rotation||r.rotation)&&(a.rotation=t.Transition.number(o.rotation||0,r.rotation||0,e)),(o.stretch||r.stretch)&&(a.stretch=t.Transition.number(o.stretch||1,r.stretch||1,e)),a},stops(n,i,e){const s=t.isString(n[0]),a=t.isString(i[0]);return n.length===i.length&&s&&a?n.map((n,o)=>t.Transition.color(n,i[o],e)):(s&&(n=r(n)),a&&(i=r(i)),n.length<i.length?n=o(n,i.length):i.length<n.length&&(i=o(i,n.length)),n.map((n,o)=>({offset:t.Transition.number(n.offset,i[o].offset,e),color:t.Transition.color(n.color,i[o].color,e)})))}};function o(t,n){const o=n-t.length,r=[];for(let n=0;n<t.length;n++)r.push(t[n]),n<o&&r.push(t[n]);return r}function r(t){const{length:n}=t;return t.map((t,o)=>({offset:o/(n-1),color:t}))}function i(n,o,r,i,s){if(o[n]===r[n])return o[n];let a=e(o.type,n,o[n]),c=e(r.type,n,r[n]);if(a.type!==c.type){const{boxBounds:n}=s.__layout;"px"!==a.type&&(a=Object.assign(Object.assign({},a),{type:"px"}),t.AroundHelper.toPoint(a,n,a)),"px"!==c.type&&(c=Object.assign({},c),t.AroundHelper.toPoint(c,n,c))}return{type:a.type,x:t.Transition.number(a.x,c.x,i),y:t.Transition.number(a.y,c.y,i)}}function e(n,o,r){return r||(r="linear"===n?"from"===o?"top":"bottom":"from"===o?"center":"bottom"),t.isObject(r)?r:t.AroundHelper.get(r)}const s={fill:n.paintTransition,stroke:n.paintTransition};Object.assign(t.Transition.list,s);
|
|
2
|
+
//# sourceMappingURL=transition.min.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transition.min.cjs","sources":["../../../../../../src/in/packages/transition/src/AnimatePaint.ts","../../../../../../src/in/packages/transition/src/Transition.ts","../../../../../../src/in/packages/transition/src/index.ts"],"sourcesContent":["import { IPaint, IPaintString, IGradientPaint, IUI, IUnitPointData, IAlign, IGradientType, IColorStop, IColorString } from '@leafer-ui/interface'\nimport { AroundHelper, Transition, isObject, isString } from '@leafer-ui/draw'\n\n\nexport const AnimatePaint = {\n\n paintTransition(from: IPaint | IPaint[] | IPaintString, to: IPaint | IPaint[] | IPaintString, t: number, ui: IUI) {\n if (isString(from) && isString(to)) {\n return Transition.color(from, to, t)\n } else if (isObject(from) && isObject(to)) {\n return AnimatePaint.gradient(from as any, to as any, t, ui)\n } else {\n return to\n }\n },\n\n gradient(from: IGradientPaint, to: IGradientPaint, t: number, ui: IUI): IGradientPaint {\n const paint: IGradientPaint = { ...to }\n paint.from = gradientPoint('from', from, to, t, ui)\n paint.to = gradientPoint('to', from, to, t, ui)\n paint.stops = AnimatePaint.stops(from.stops, to.stops, t)\n if (from.opacity || to.opacity) paint.opacity = Transition.number(from.opacity || 1, to.opacity || 1, t)\n if (from.rotation || to.rotation) paint.rotation = Transition.number(from.rotation || 0, to.rotation || 0, t)\n if (from.stretch || to.stretch) paint.stretch = Transition.number(from.stretch || 1, to.stretch || 1, t)\n return paint\n },\n\n stops(from: IColorStop[] | IColorString[], to: IColorStop[] | IColorString[], t: number): IColorStop[] | IColorString[] {\n const fromStr = isString(from[0]), toStr = isString(to[0])\n if (from.length === to.length && fromStr && toStr) return from.map((color, index) => Transition.color(color as string, to[index] as string, t))\n\n if (fromStr) from = toStops(from as IColorString[])\n if (toStr) to = toStops(to as IColorString[])\n\n if (from.length < to.length) from = fixStops(from as IColorStop[], to.length)\n else if (to.length < from.length) to = fixStops(to as IColorStop[], from.length)\n\n return from.map((stop, index) => {\n return {\n offset: Transition.number((stop as IColorStop).offset, (to[index] as IColorStop).offset, t),\n color: Transition.color((stop as IColorStop).color, (to[index] as IColorStop).color, t)\n }\n })\n }\n\n}\n\n\nfunction fixStops(stops: IColorStop[], len: number): IColorStop[] {\n const add = len - stops.length, newStops = []\n for (let i = 0; i < stops.length; i++) {\n newStops.push(stops[i])\n if (i < add) newStops.push(stops[i])\n }\n return newStops\n}\n\nfunction toStops(stops: IColorString[]): IColorStop[] {\n const { length } = stops\n return stops.map((color, index) => { return { offset: index / (length - 1), color } }) as IColorStop[]\n}\n\nfunction gradientPoint(fromTo: 'from' | 'to', a: IGradientPaint, b: IGradientPaint, t: number, ui: IUI): IUnitPointData | IAlign {\n if (a[fromTo] === b[fromTo]) return a[fromTo]\n\n let from = toGradientPoint(a.type, fromTo, a[fromTo])\n let to = toGradientPoint(b.type, fromTo, b[fromTo])\n\n if (from.type !== to.type) {\n const { boxBounds } = ui.__layout\n if (from.type !== 'px') from = { ...from, type: 'px' }, AroundHelper.toPoint(from, boxBounds, from)\n if (to.type !== 'px') to = { ...to }, AroundHelper.toPoint(to, boxBounds, to)\n }\n\n return {\n type: from.type,\n x: Transition.number(from.x, to.x, t),\n y: Transition.number(from.y, to.y, t)\n }\n}\n\nfunction toGradientPoint(type: IGradientType, fromTo: 'from' | 'to', point: IUnitPointData | IAlign): IUnitPointData {\n if (!point) point = type === 'linear' ? (fromTo === 'from' ? 'top' : 'bottom') : (fromTo === 'from' ? 'center' : 'bottom')\n return isObject(point) ? point : AroundHelper.get(point)\n}","import { AnimatePaint } from './AnimatePaint'\n\n\nexport const TransitionList = {\n\n fill: AnimatePaint.paintTransition,\n\n stroke: AnimatePaint.paintTransition,\n\n}","import { Transition } from '@leafer-ui/draw'\n\nimport { TransitionList } from './Transition'\n\nObject.assign(Transition.list, TransitionList)"],"names":["AnimatePaint","paintTransition","from","to","t","ui","isString","Transition","color","isObject","gradient","paint","Object","assign","gradientPoint","stops","opacity","number","rotation","stretch","fromStr","toStr","length","map","index","toStops","fixStops","stop","offset","len","add","newStops","i","push","fromTo","a","b","toGradientPoint","type","boxBounds","__layout","AroundHelper","toPoint","x","y","point","get","TransitionList","fill","stroke","list"],"mappings":"8CAIO,MAAMA,EAAe,CAExBC,gBAAe,CAACC,EAAwCC,EAAsCC,EAAWC,IACjGC,EAAAA,SAASJ,IAASI,EAAAA,SAASH,GACpBI,EAAAA,WAAWC,MAAMN,EAAMC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AGxC,GAE3C,CAEA,SAASiC,EAAgBC,EAAqBJ,EAAuBW,GAEjE,OADKA,IAAOA,EAAiB,WAATP,EAAgC,SAAXJ,EAAoB,MAAQ,SAAwB,SAAXA,EAAoB,SAAW,UAC1GzB,EAAAA,SAASoC,GAASA,EAAQJ,EAAAA,aAAaK,IAAID,EACtD,CCjFO,MAAME,EAAiB,CAE1BC,KAAMhD,EAAaC,gBAEnBgD,OAAQjD,EAAaC,iBCHzBW,OAAOC,OAAON,EAAAA,WAAW2C,KAAMH"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
!function(t){"use strict";const n={paintTransition:(o,r,i,e)=>t.isString(o)&&t.isString(r)?t.Transition.color(o,r,i):t.isObject(o)&&t.isObject(r)?n.gradient(o,r,i,e):r,gradient(o,r,e,s){const a=Object.assign({},r);return a.from=i("from",o,r,e,s),a.to=i("to",o,r,e,s),a.stops=n.stops(o.stops,r.stops,e),(o.opacity||r.opacity)&&(a.opacity=t.Transition.number(o.opacity||1,r.opacity||1,e)),(o.rotation||r.rotation)&&(a.rotation=t.Transition.number(o.rotation||0,r.rotation||0,e)),(o.stretch||r.stretch)&&(a.stretch=t.Transition.number(o.stretch||1,r.stretch||1,e)),a},stops(n,i,e){const s=t.isString(n[0]),a=t.isString(i[0]);return n.length===i.length&&s&&a?n.map((n,o)=>t.Transition.color(n,i[o],e)):(s&&(n=r(n)),a&&(i=r(i)),n.length<i.length?n=o(n,i.length):i.length<n.length&&(i=o(i,n.length)),n.map((n,o)=>({offset:t.Transition.number(n.offset,i[o].offset,e),color:t.Transition.color(n.color,i[o].color,e)})))}};function o(t,n){const o=n-t.length,r=[];for(let n=0;n<t.length;n++)r.push(t[n]),n<o&&r.push(t[n]);return r}function r(t){const{length:n}=t;return t.map((t,o)=>({offset:o/(n-1),color:t}))}function i(n,o,r,i,s){if(o[n]===r[n])return o[n];let a=e(o.type,n,o[n]),c=e(r.type,n,r[n]);if(a.type!==c.type){const{boxBounds:n}=s.__layout;"px"!==a.type&&(a=Object.assign(Object.assign({},a),{type:"px"}),t.AroundHelper.toPoint(a,n,a)),"px"!==c.type&&(c=Object.assign({},c),t.AroundHelper.toPoint(c,n,c))}return{type:a.type,x:t.Transition.number(a.x,c.x,i),y:t.Transition.number(a.y,c.y,i)}}function e(n,o,r){return r||(r="linear"===n?"from"===o?"top":"bottom":"from"===o?"center":"bottom"),t.isObject(r)?r:t.AroundHelper.get(r)}const s={fill:n.paintTransition,stroke:n.paintTransition};Object.assign(t.Transition.list,s)}(LeaferUI);
|
|
2
|
+
//# sourceMappingURL=transition.min.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transition.min.js","sources":["../../../../../../src/in/packages/transition/src/AnimatePaint.ts","../../../../../../src/in/packages/transition/src/Transition.ts","../../../../../../src/in/packages/transition/src/index.ts"],"sourcesContent":["import { IPaint, IPaintString, IGradientPaint, IUI, IUnitPointData, IAlign, IGradientType, IColorStop, IColorString } from '@leafer-ui/interface'\nimport { AroundHelper, Transition, isObject, isString } from '@leafer-ui/draw'\n\n\nexport const AnimatePaint = {\n\n paintTransition(from: IPaint | IPaint[] | IPaintString, to: IPaint | IPaint[] | IPaintString, t: number, ui: IUI) {\n if (isString(from) && isString(to)) {\n return Transition.color(from, to, t)\n } else if (isObject(from) && isObject(to)) {\n return AnimatePaint.gradient(from as any, to as any, t, ui)\n } else {\n return to\n }\n },\n\n gradient(from: IGradientPaint, to: IGradientPaint, t: number, ui: IUI): IGradientPaint {\n const paint: IGradientPaint = { ...to }\n paint.from = gradientPoint('from', from, to, t, ui)\n paint.to = gradientPoint('to', from, to, t, ui)\n paint.stops = AnimatePaint.stops(from.stops, to.stops, t)\n if (from.opacity || to.opacity) paint.opacity = Transition.number(from.opacity || 1, to.opacity || 1, t)\n if (from.rotation || to.rotation) paint.rotation = Transition.number(from.rotation || 0, to.rotation || 0, t)\n if (from.stretch || to.stretch) paint.stretch = Transition.number(from.stretch || 1, to.stretch || 1, t)\n return paint\n },\n\n stops(from: IColorStop[] | IColorString[], to: IColorStop[] | IColorString[], t: number): IColorStop[] | IColorString[] {\n const fromStr = isString(from[0]), toStr = isString(to[0])\n if (from.length === to.length && fromStr && toStr) return from.map((color, index) => Transition.color(color as string, to[index] as string, t))\n\n if (fromStr) from = toStops(from as IColorString[])\n if (toStr) to = toStops(to as IColorString[])\n\n if (from.length < to.length) from = fixStops(from as IColorStop[], to.length)\n else if (to.length < from.length) to = fixStops(to as IColorStop[], from.length)\n\n return from.map((stop, index) => {\n return {\n offset: Transition.number((stop as IColorStop).offset, (to[index] as IColorStop).offset, t),\n color: Transition.color((stop as IColorStop).color, (to[index] as IColorStop).color, t)\n }\n })\n }\n\n}\n\n\nfunction fixStops(stops: IColorStop[], len: number): IColorStop[] {\n const add = len - stops.length, newStops = []\n for (let i = 0; i < stops.length; i++) {\n newStops.push(stops[i])\n if (i < add) newStops.push(stops[i])\n }\n return newStops\n}\n\nfunction toStops(stops: IColorString[]): IColorStop[] {\n const { length } = stops\n return stops.map((color, index) => { return { offset: index / (length - 1), color } }) as IColorStop[]\n}\n\nfunction gradientPoint(fromTo: 'from' | 'to', a: IGradientPaint, b: IGradientPaint, t: number, ui: IUI): IUnitPointData | IAlign {\n if (a[fromTo] === b[fromTo]) return a[fromTo]\n\n let from = toGradientPoint(a.type, fromTo, a[fromTo])\n let to = toGradientPoint(b.type, fromTo, b[fromTo])\n\n if (from.type !== to.type) {\n const { boxBounds } = ui.__layout\n if (from.type !== 'px') from = { ...from, type: 'px' }, AroundHelper.toPoint(from, boxBounds, from)\n if (to.type !== 'px') to = { ...to }, AroundHelper.toPoint(to, boxBounds, to)\n }\n\n return {\n type: from.type,\n x: Transition.number(from.x, to.x, t),\n y: Transition.number(from.y, to.y, t)\n }\n}\n\nfunction toGradientPoint(type: IGradientType, fromTo: 'from' | 'to', point: IUnitPointData | IAlign): IUnitPointData {\n if (!point) point = type === 'linear' ? (fromTo === 'from' ? 'top' : 'bottom') : (fromTo === 'from' ? 'center' : 'bottom')\n return isObject(point) ? point : AroundHelper.get(point)\n}","import { AnimatePaint } from './AnimatePaint'\n\n\nexport const TransitionList = {\n\n fill: AnimatePaint.paintTransition,\n\n stroke: AnimatePaint.paintTransition,\n\n}","import { Transition } from '@leafer-ui/draw'\n\nimport { TransitionList } from './Transition'\n\nObject.assign(Transition.list, TransitionList)"],"names":["AnimatePaint","paintTransition","from","to","t","ui","isString","Transition","color","isObject","gradient","paint","Object","assign","gradientPoint","stops","opacity","number","rotation","stretch","fromStr","toStr","length","map","index","toStops","fixStops","stop","offset","len","add","newStops","i","push","fromTo","a","b","toGradientPoint","type","boxBounds","__layout","AroundHelper","toPoint","x","y","point","get","TransitionList","fill","stroke","list"],"mappings":"0BAIO,MAAMA,EAAe,CAExBC,gBAAe,CAACC,EAAwCC,EAAsCC,EAAWC,IACjGC,EAAAA,SAASJ,IAASI,EAAAA,SAASH,GACpBI,EAAAA,WAAWC,MAAMN,EAAMC,EAAIC,GAC3BK,EAAAA,SAASP,IAASO,EAAAA,SAASN,GAC3BH,EAAaU,SAASR,EAAaC,EAAWC,EAAGC,GAEjDF,EAIf,QAAAO,CAASR,EAAsBC,EAAoBC,EAAWC,GAC1D,MAAMM,EAAKC,OAAAC,OAAA,CAAA,EAAwBV,GAOnC,OANAQ,EAAMT,KAAOY,EAAc,OAAQZ,EAAMC,EAAIC,EAAGC,GAChDM,EAAMR,GAAKW,EAAc,KAAMZ,EAAMC,EAAIC,EAAGC,GAC5CM,EAAMI,MAAQf,EAAae,MAAMb,EAAKa,MAAOZ,EAAGY,MAAOX,IACnDF,EAAKc,SAAWb,EAAGa,WAASL,EAAMK,QAAUT,aAAWU,OAAOf,EAAKc,SAAW,EAAGb,EAAGa,SAAW,EAAGZ,KAClGF,EAAKgB,UAAYf,EAAGe,YAAUP,EAAMO,SAAWX,aAAWU,OAAOf,EAAKgB,UAAY,EAAGf,EAAGe,UAAY,EAAGd,KACvGF,EAAKiB,SAAWhB,EAAGgB,WAASR,EAAMQ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tC,IAAIhC,EAAOmC,EAAgBF,EAAEG,KAAMJ,EAAQC,EAAED,IACzC/B,EAAKkC,EAAgBD,EAAEE,KAAMJ,EAAQE,EAAEF,IAE3C,GAAIhC,EAAKoC,OAASnC,EAAGmC,KAAM,CACvB,MAAMC,UAAEA,GAAclC,EAAGmC,SACP,OAAdtC,EAAKoC,OAAepC,iCAAYA,GAAI,CAAEoC,KAAM,OAAQG,EAAAA,aAAaC,QAAQxC,EAAMqC,EAAWrC,IAC9E,OAAZC,EAAGmC,OAAenC,EAAES,OAAAC,OAAA,CAAA,EAAQV,GAAMsC,EAAAA,aAAaC,QAAQvC,EAAIoC,EAAWpC,GAC9E,CAEA,MAAO,CACHmC,KAAMpC,EAAKoC,KACXK,EAAGpC,EAAAA,WAAWU,OAAOf,EAAKyC,EAAGxC,EAAGwC,EAAGvC,GACnCwC,EAAGrC,EAAAA,WAAWU,OAAOf,EAAK0C,EAAGzC,EAAGyC,EAAGxC,GAE3C,CAEA,SAASiC,EAAgBC,EAAqBJ,EAAuBW,GAEjE,OADKA,IAAOA,EAAiB,WAATP,EAAgC,SAAXJ,EAAoB,MAAQ,SAAwB,SAAXA,EAAoB,SAAW,UAC1GzB,EAAAA,SAASoC,GAASA,EAAQJ,EAAAA,aAAaK,IAAID,EACtD,CCjFO,MAAME,EAAiB,CAE1BC,KAAMhD,EAAaC,gBAEnBgD,OAAQjD,EAAaC,iBCHzBW,OAAOC,OAAON,EAAAA,WAAW2C,KAAMH"}
|
package/package.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer-in/transition",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.2",
|
|
4
4
|
"description": "@leafer-in/transition",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"type": "module",
|
|
8
|
-
"main": "dist/transition.esm.js",
|
|
8
|
+
"main": "dist/transition.esm.min.js",
|
|
9
9
|
"exports": {
|
|
10
|
-
"import": "./dist/transition.esm.js",
|
|
11
|
-
"require": "./dist/transition.cjs",
|
|
10
|
+
"import": "./dist/transition.esm.min.js",
|
|
11
|
+
"require": "./dist/transition.min.cjs",
|
|
12
12
|
"types": "./types/index.d.ts"
|
|
13
13
|
},
|
|
14
14
|
"types": "types/index.d.ts",
|
|
15
|
-
"unpkg": "dist/transition.js",
|
|
16
|
-
"jsdelivr": "dist/transition.js",
|
|
15
|
+
"unpkg": "dist/transition.min.js",
|
|
16
|
+
"jsdelivr": "dist/transition.min.js",
|
|
17
17
|
"files": [
|
|
18
18
|
"src",
|
|
19
19
|
"types",
|