@wix/motion 1.627.0 → 1.628.0
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/cjs/CustomAnimation.js +190 -0
- package/dist/cjs/CustomAnimation.js.map +1 -0
- package/dist/cjs/api/webAnimations.js +5 -1
- package/dist/cjs/api/webAnimations.js.map +1 -1
- package/dist/cjs/library/mouse/CustomMouse.js +3 -0
- package/dist/cjs/library/mouse/CustomMouse.js.map +1 -1
- package/dist/esm/CustomAnimation.js +184 -0
- package/dist/esm/CustomAnimation.js.map +1 -0
- package/dist/esm/api/webAnimations.js +5 -1
- package/dist/esm/api/webAnimations.js.map +1 -1
- package/dist/esm/library/mouse/CustomMouse.js +3 -0
- package/dist/esm/library/mouse/CustomMouse.js.map +1 -1
- package/dist/types/CustomAnimation.d.ts +52 -0
- package/dist/types/CustomAnimation.d.ts.map +1 -0
- package/dist/types/api/webAnimations.d.ts.map +1 -1
- package/dist/types/library/mouse/CustomMouse.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
exports.__esModule = true;
|
|
5
|
+
exports.CustomAnimation = void 0;
|
|
6
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
7
|
+
/**
|
|
8
|
+
* @class CustomAnimation
|
|
9
|
+
*
|
|
10
|
+
* A wrapper object for Animation that mimics the same interface but implements CustomEffect that runs JS code instead of KeyframeEffect.
|
|
11
|
+
* The class is implemented by holding an inner Animation object instead of inheritance due to some browsers not allowing extension of built-in objects.
|
|
12
|
+
*/
|
|
13
|
+
class CustomAnimation {
|
|
14
|
+
constructor(customEffect, target, effectOptions, timingOptions) {
|
|
15
|
+
(0, _defineProperty2.default)(this, "_animation", void 0);
|
|
16
|
+
(0, _defineProperty2.default)(this, "customEffect", void 0);
|
|
17
|
+
(0, _defineProperty2.default)(this, "progress", void 0);
|
|
18
|
+
(0, _defineProperty2.default)(this, "_tickCbId", void 0);
|
|
19
|
+
(0, _defineProperty2.default)(this, "_finishHandler", void 0);
|
|
20
|
+
// overriding composite so that animation is not replaced and removed
|
|
21
|
+
const effect = new KeyframeEffect(target, [], {
|
|
22
|
+
...effectOptions,
|
|
23
|
+
composite: 'add'
|
|
24
|
+
});
|
|
25
|
+
const {
|
|
26
|
+
timeline
|
|
27
|
+
} = timingOptions;
|
|
28
|
+
this._animation = new Animation(effect, timeline);
|
|
29
|
+
this._tickCbId = null;
|
|
30
|
+
this.progress = null;
|
|
31
|
+
this.customEffect = progress => customEffect(effect.target, progress);
|
|
32
|
+
|
|
33
|
+
// stop loop if animation is removed from the DOM after finish (does not fire 'remove' event)
|
|
34
|
+
this._finishHandler = _ => {
|
|
35
|
+
var _target;
|
|
36
|
+
if (!((_target = this.effect.target) != null && _target.getAnimations().find(a => a === this._animation))) {
|
|
37
|
+
this.cancel();
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
this.addEventListener('finish', this._finishHandler);
|
|
41
|
+
this.addEventListener('remove', this._finishHandler);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// private tick method for customEffect loop implementation
|
|
45
|
+
_tick() {
|
|
46
|
+
try {
|
|
47
|
+
var _this$effect;
|
|
48
|
+
const progress = ((_this$effect = this.effect) == null ? void 0 : _this$effect.getComputedTiming().progress) ?? null;
|
|
49
|
+
if (progress !== this.progress) {
|
|
50
|
+
var _this$customEffect;
|
|
51
|
+
(_this$customEffect = this.customEffect) == null || _this$customEffect.call(this, progress);
|
|
52
|
+
this.progress = progress;
|
|
53
|
+
}
|
|
54
|
+
this._tickCbId = requestAnimationFrame(() => {
|
|
55
|
+
this._tick();
|
|
56
|
+
});
|
|
57
|
+
} catch (error) {
|
|
58
|
+
this._tickCbId = null;
|
|
59
|
+
console.error(`failed to run customEffect! effectId: ${this.id}, error: ${error instanceof Error ? error.message : error}`);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Animation timing properties
|
|
64
|
+
get currentTime() {
|
|
65
|
+
return this._animation.currentTime;
|
|
66
|
+
}
|
|
67
|
+
set currentTime(time) {
|
|
68
|
+
this._animation.currentTime = time;
|
|
69
|
+
}
|
|
70
|
+
get startTime() {
|
|
71
|
+
return this._animation.startTime;
|
|
72
|
+
}
|
|
73
|
+
set startTime(time) {
|
|
74
|
+
this._animation.startTime = time;
|
|
75
|
+
}
|
|
76
|
+
get playbackRate() {
|
|
77
|
+
return this._animation.playbackRate;
|
|
78
|
+
}
|
|
79
|
+
set playbackRate(speed) {
|
|
80
|
+
this._animation.playbackRate = speed;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Animation basic properties
|
|
84
|
+
get id() {
|
|
85
|
+
return this._animation.id;
|
|
86
|
+
}
|
|
87
|
+
set id(uid) {
|
|
88
|
+
this._animation.id = uid;
|
|
89
|
+
}
|
|
90
|
+
get effect() {
|
|
91
|
+
return this._animation.effect;
|
|
92
|
+
}
|
|
93
|
+
set effect(e) {
|
|
94
|
+
this._animation.effect = e;
|
|
95
|
+
}
|
|
96
|
+
get timeline() {
|
|
97
|
+
return this._animation.timeline;
|
|
98
|
+
}
|
|
99
|
+
set timeline(tl) {
|
|
100
|
+
this._animation.timeline = tl;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// Animation readonly state properties
|
|
104
|
+
get finished() {
|
|
105
|
+
return this._animation.finished;
|
|
106
|
+
}
|
|
107
|
+
get pending() {
|
|
108
|
+
return this._animation.pending;
|
|
109
|
+
}
|
|
110
|
+
get playState() {
|
|
111
|
+
return this._animation.playState;
|
|
112
|
+
}
|
|
113
|
+
get ready() {
|
|
114
|
+
return this._animation.ready;
|
|
115
|
+
}
|
|
116
|
+
get replaceState() {
|
|
117
|
+
return this._animation.replaceState;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// Animation event handlers
|
|
121
|
+
get oncancel() {
|
|
122
|
+
return this._animation.oncancel;
|
|
123
|
+
}
|
|
124
|
+
set oncancel(cb) {
|
|
125
|
+
this._animation.oncancel = cb;
|
|
126
|
+
}
|
|
127
|
+
get onfinish() {
|
|
128
|
+
return this._animation.onfinish;
|
|
129
|
+
}
|
|
130
|
+
set onfinish(cb) {
|
|
131
|
+
this._animation.onfinish = cb;
|
|
132
|
+
}
|
|
133
|
+
get onremove() {
|
|
134
|
+
return this._animation.onremove;
|
|
135
|
+
}
|
|
136
|
+
set onremove(cb) {
|
|
137
|
+
this._animation.onremove = cb;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// CustomAnimation overridden methods
|
|
141
|
+
play() {
|
|
142
|
+
this._animation.play();
|
|
143
|
+
cancelAnimationFrame(this._tickCbId);
|
|
144
|
+
this._tickCbId = requestAnimationFrame(() => this._tick());
|
|
145
|
+
}
|
|
146
|
+
pause() {
|
|
147
|
+
this._animation.pause();
|
|
148
|
+
cancelAnimationFrame(this._tickCbId);
|
|
149
|
+
this._tickCbId = null;
|
|
150
|
+
}
|
|
151
|
+
cancel() {
|
|
152
|
+
this.removeEventListener('finish', this._finishHandler);
|
|
153
|
+
this.removeEventListener('remove', this._finishHandler);
|
|
154
|
+
this._animation.cancel();
|
|
155
|
+
// signaling cancelation for customEffect to handle it as desired
|
|
156
|
+
this.customEffect(null);
|
|
157
|
+
cancelAnimationFrame(this._tickCbId);
|
|
158
|
+
this._tickCbId = null;
|
|
159
|
+
}
|
|
160
|
+
commitStyles() {
|
|
161
|
+
console.warn('CustomEffect animations do not support commitStyles method as they have no style to commit');
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// Animation methods without override
|
|
165
|
+
finish() {
|
|
166
|
+
this._animation.finish();
|
|
167
|
+
}
|
|
168
|
+
persist() {
|
|
169
|
+
this._animation.persist();
|
|
170
|
+
}
|
|
171
|
+
reverse() {
|
|
172
|
+
this._animation.reverse();
|
|
173
|
+
}
|
|
174
|
+
updatePlaybackRate(playbackRate) {
|
|
175
|
+
this._animation.updatePlaybackRate(playbackRate);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// Animation events API
|
|
179
|
+
addEventListener(type, listener, options) {
|
|
180
|
+
this._animation.addEventListener(type, listener, options);
|
|
181
|
+
}
|
|
182
|
+
removeEventListener(type, listener, options) {
|
|
183
|
+
this._animation.removeEventListener(type, listener, options);
|
|
184
|
+
}
|
|
185
|
+
dispatchEvent(event) {
|
|
186
|
+
return this._animation.dispatchEvent(event);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
exports.CustomAnimation = CustomAnimation;
|
|
190
|
+
//# sourceMappingURL=CustomAnimation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["CustomAnimation","constructor","customEffect","target","effectOptions","timingOptions","_defineProperty2","default","effect","KeyframeEffect","composite","timeline","_animation","Animation","_tickCbId","progress","_finishHandler","_","_target","getAnimations","find","a","cancel","addEventListener","_tick","_this$effect","getComputedTiming","_this$customEffect","call","requestAnimationFrame","error","console","id","Error","message","currentTime","time","startTime","playbackRate","speed","uid","e","tl","finished","pending","playState","ready","replaceState","oncancel","cb","onfinish","onremove","play","cancelAnimationFrame","pause","removeEventListener","commitStyles","warn","finish","persist","reverse","updatePlaybackRate","type","listener","options","dispatchEvent","event","exports"],"sources":["../../src/CustomAnimation.ts"],"sourcesContent":["/**\n * @class CustomAnimation\n *\n * A wrapper object for Animation that mimics the same interface but implements CustomEffect that runs JS code instead of KeyframeEffect.\n * The class is implemented by holding an inner Animation object instead of inheritance due to some browsers not allowing extension of built-in objects.\n */\nexport class CustomAnimation {\n _animation: Animation;\n customEffect: (progress: number | null) => void;\n progress: number | null;\n _tickCbId: number | null;\n _finishHandler: (_: any) => void;\n\n constructor(\n customEffect: (element: Element | null, progress: number | null) => void,\n target: Element | null,\n effectOptions: KeyframeEffectOptions,\n timingOptions: { timeline?: AnimationTimeline | null },\n ) {\n // overriding composite so that animation is not replaced and removed\n const effect = new KeyframeEffect(target, [], {\n ...effectOptions,\n composite: 'add',\n });\n const { timeline } = timingOptions;\n this._animation = new Animation(effect, timeline);\n\n this._tickCbId = null;\n this.progress = null;\n this.customEffect = (progress: number | null) =>\n customEffect(effect.target, progress);\n\n // stop loop if animation is removed from the DOM after finish (does not fire 'remove' event)\n this._finishHandler = (_: any) => {\n if (\n !(this.effect as KeyframeEffect).target\n ?.getAnimations()\n .find((a) => a === this._animation)\n ) {\n this.cancel();\n }\n };\n this.addEventListener('finish', this._finishHandler);\n this.addEventListener('remove', this._finishHandler);\n }\n\n // private tick method for customEffect loop implementation\n private _tick() {\n try {\n const progress = this.effect?.getComputedTiming().progress ?? null;\n if (progress !== this.progress) {\n this.customEffect?.(progress);\n this.progress = progress;\n }\n this._tickCbId = requestAnimationFrame(() => {\n this._tick();\n });\n } catch (error) {\n this._tickCbId = null;\n console.error(\n `failed to run customEffect! effectId: ${this.id}, error: ${\n error instanceof Error ? error.message : error\n }`,\n );\n }\n }\n\n // Animation timing properties\n get currentTime() {\n return this._animation.currentTime;\n }\n set currentTime(time: CSSNumberish | null) {\n this._animation.currentTime = time;\n }\n get startTime() {\n return this._animation.startTime;\n }\n set startTime(time: CSSNumberish | null) {\n this._animation.startTime = time;\n }\n get playbackRate() {\n return this._animation.playbackRate;\n }\n set playbackRate(speed: number) {\n this._animation.playbackRate = speed;\n }\n\n // Animation basic properties\n get id() {\n return this._animation.id;\n }\n set id(uid: string) {\n this._animation.id = uid;\n }\n get effect() {\n return this._animation.effect;\n }\n set effect(e: AnimationEffect | null) {\n this._animation.effect = e;\n }\n get timeline() {\n return this._animation.timeline;\n }\n set timeline(tl: AnimationTimeline | null) {\n this._animation.timeline = tl;\n }\n\n // Animation readonly state properties\n get finished() {\n return this._animation.finished;\n }\n get pending() {\n return this._animation.pending;\n }\n get playState() {\n return this._animation.playState;\n }\n get ready() {\n return this._animation.ready;\n }\n get replaceState() {\n return this._animation.replaceState;\n }\n\n // Animation event handlers\n get oncancel() {\n return this._animation.oncancel;\n }\n set oncancel(\n cb: ((this: Animation, ev: AnimationPlaybackEvent) => any) | null,\n ) {\n this._animation.oncancel = cb;\n }\n get onfinish() {\n return this._animation.onfinish;\n }\n set onfinish(\n cb: ((this: Animation, ev: AnimationPlaybackEvent) => any) | null,\n ) {\n this._animation.onfinish = cb;\n }\n get onremove() {\n return this._animation.onremove;\n }\n set onremove(cb: ((this: Animation, ev: Event) => any) | null) {\n this._animation.onremove = cb;\n }\n\n // CustomAnimation overridden methods\n play() {\n this._animation.play();\n cancelAnimationFrame(this._tickCbId!);\n this._tickCbId = requestAnimationFrame(() => this._tick());\n }\n\n pause() {\n this._animation.pause();\n cancelAnimationFrame(this._tickCbId!);\n this._tickCbId = null;\n }\n\n cancel() {\n this.removeEventListener('finish', this._finishHandler);\n this.removeEventListener('remove', this._finishHandler);\n this._animation.cancel();\n // signaling cancelation for customEffect to handle it as desired\n this.customEffect(null);\n cancelAnimationFrame(this._tickCbId!);\n this._tickCbId = null;\n }\n\n commitStyles() {\n console.warn(\n 'CustomEffect animations do not support commitStyles method as they have no style to commit',\n );\n }\n\n // Animation methods without override\n finish() {\n this._animation.finish();\n }\n persist() {\n this._animation.persist();\n }\n reverse() {\n this._animation.reverse();\n }\n updatePlaybackRate(playbackRate: number) {\n this._animation.updatePlaybackRate(playbackRate);\n }\n\n // Animation events API\n addEventListener(\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | AddEventListenerOptions,\n ) {\n this._animation.addEventListener(type, listener, options);\n }\n removeEventListener(\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | AddEventListenerOptions,\n ) {\n this._animation.removeEventListener(type, listener, options);\n }\n dispatchEvent(event: Event) {\n return this._animation.dispatchEvent(event);\n }\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,eAAe,CAAC;EAO3BC,WAAWA,CACTC,YAAwE,EACxEC,MAAsB,EACtBC,a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;EAC3B;EACAC,kBAAkBA,CAACvB,YAAoB,EAAE;IACvC,IAAI,CAAC1B,UAAU,CAACiD,kBAAkB,CAACvB,YAAY,CAAC;EAClD;;EAEA;EACAf,gBAAgBA,CACduC,IAAY,EACZC,QAA4C,EAC5CC,OAA2C,EAC3C;IACA,IAAI,CAACpD,UAAU,CAACW,gBAAgB,CAACuC,IAAI,EAAEC,QAAQ,EAAEC,OAAO,CAAC;EAC3D;EACAT,mBAAmBA,CACjBO,IAAY,EACZC,QAA4C,EAC5CC,OAA2C,EAC3C;IACA,IAAI,CAACpD,UAAU,CAAC2C,mBAAmB,CAACO,IAAI,EAAEC,QAAQ,EAAEC,OAAO,CAAC;EAC9D;EACAC,aAAaA,CAACC,KAAY,EAAE;IAC1B,OAAO,IAAI,CAACtD,UAAU,CAACqD,aAAa,CAACC,KAAK,CAAC;EAC7C;AACF;AAACC,OAAA,CAAAnE,eAAA,GAAAA,eAAA","ignoreList":[]}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
exports.__esModule = true;
|
|
5
5
|
exports.getWebAnimation = getWebAnimation;
|
|
6
|
+
var _CustomAnimation = require("../CustomAnimation");
|
|
6
7
|
var _AnimationGroup = require("../AnimationGroup");
|
|
7
8
|
var _common = require("./common");
|
|
8
9
|
var _fastdom = _interopRequireDefault(require("fastdom"));
|
|
@@ -87,7 +88,10 @@ function getWebAnimation(target, animationOptions, trigger, options, ownerDocume
|
|
|
87
88
|
}
|
|
88
89
|
keyframeEffect.setKeyframes(effect.keyframes);
|
|
89
90
|
});
|
|
90
|
-
const
|
|
91
|
+
const timingOptions = isViewProgress && timeline ? {
|
|
92
|
+
timeline: timeline
|
|
93
|
+
} : {};
|
|
94
|
+
const animation = typeof effect.customEffect === 'function' ? new _CustomAnimation.CustomAnimation(effect.customEffect, effectTarget || null, effectOptions, timingOptions) : new Animation(keyframeEffect, timingOptions.timeline);
|
|
91
95
|
|
|
92
96
|
// if this is a ScrubAnimation with view-progress trigger and the browser supports the ViewTimeline API
|
|
93
97
|
if (isViewProgress) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_AnimationGroup","require","_common","_fastdom","_interopRequireDefault","getWebAnimationEffect","preset","animation","target","options","type","duration","reducedMotion","iterations","undefined","domApi","HTMLElement","measure","mutate","web","getWebAnimation","animationOptions","trigger","ownerDocument","element","getElement","effectOptions","customEffect","namedEffect","id","mouseAnimationPreset","getNamedEffect","mouseAnimationFactory","animationsData","data","getEffectsData","effectId","timeline","isViewProgress","window","ViewTimeline","subject","componentId","animations","map","effect","part","effectTarget","querySelector","keyframeEffect","KeyframeEffect","fastdom","updateTiming","timing","setKeyframes","keyframes","Animation","start","end","getRanges","rangeStart","rangeEnd","play","startOffset","endOffset","_offset","_offset2","startOffsetToWrite","endOffsetToWrite","Object","assign","name","offset","value","add","startOffsetAdd","endOffsetAdd","AnimationGroup","measured","Promise","resolve"],"sources":["../../../src/api/webAnimations.ts"],"sourcesContent":["import type {\n AnimationData,\n AnimationDataForScrub,\n AnimationEffectAPI,\n AnimationOptions,\n MouseAnimationFactory,\n MouseAnimationInstance,\n ScrubAnimationOptions,\n TriggerVariant,\n WebAnimationEffectFactory,\n} from '../types';\nimport { AnimationGroup } from '../AnimationGroup';\nimport {\n getElement,\n measure,\n mutate,\n getRanges,\n getNamedEffect,\n getEffectsData,\n} from './common';\nimport fastdom from 'fastdom';\n\nfunction getWebAnimationEffect(\n preset: AnimationEffectAPI<any> | WebAnimationEffectFactory<any> | null,\n animation: AnimationOptions,\n target: HTMLElement | string | null,\n options?: Record<string, any>,\n): AnimationData[] | MouseAnimationFactory {\n if (preset) {\n // validate duration is a number over 0\n if (animation.type === 'TimeAnimationOptions') {\n animation.duration = animation.duration || 1;\n\n if (options?.reducedMotion) {\n if (animation.iterations === 1 || animation.iterations == undefined) {\n animation = { ...animation, duration: 1 };\n } else {\n return [];\n }\n }\n }\n\n let domApi;\n if (target instanceof HTMLElement) {\n domApi = { measure: measure(target), mutate: mutate(target) };\n }\n\n return (preset as AnimationEffectAPI<any>).web\n ? (preset as AnimationEffectAPI<any>).web(animation, domApi, options)\n : (preset as WebAnimationEffectFactory<any>)(animation, domApi, options);\n }\n\n return [];\n}\n\nfunction getWebAnimation(\n target: HTMLElement | string | null,\n animationOptions: AnimationOptions,\n trigger?: Partial<TriggerVariant> & { element?: HTMLElement },\n options?: Record<string, any>,\n ownerDocument?: Document,\n): AnimationGroup | MouseAnimationInstance {\n const element =\n target instanceof HTMLElement ? target : getElement(target, ownerDocument);\n\n if (trigger?.trigger === 'pointer-move') {\n let effectOptions = animationOptions;\n\n if (animationOptions.customEffect) {\n effectOptions = {\n ...animationOptions,\n namedEffect: { id: '', type: 'CustomMouse' },\n };\n }\n\n // TODO: need to fix the type here, currently lying about the returned type to be WebAnimationEffectFactory instead of MouseAnimationFactoryCreate\n const mouseAnimationPreset = getNamedEffect(\n effectOptions,\n ) as WebAnimationEffectFactory<'scrub'>;\n const mouseAnimationFactory = getWebAnimationEffect(\n mouseAnimationPreset,\n animationOptions,\n element,\n options,\n ) as MouseAnimationFactory;\n\n return mouseAnimationFactory(element as HTMLElement);\n }\n\n // get the preset for the given animation options\n const namedEffect = getNamedEffect(\n animationOptions,\n ) as AnimationEffectAPI<any> | null;\n\n const animationsData = getWebAnimationEffect(\n namedEffect,\n animationOptions,\n element,\n options,\n ) as AnimationData[];\n const data = getEffectsData(animationsData, animationOptions.effectId);\n\n let timeline: typeof window.ViewTimeline | undefined;\n const isViewProgress = trigger?.trigger === 'view-progress';\n\n // if this is a ScrubAnimation with view-progress trigger and the browser supports the ViewTimeline API\n if (isViewProgress && window.ViewTimeline) {\n // generate the timeline object\n // @ts-expect-error\n timeline = new ViewTimeline({\n subject: trigger.element || getElement(trigger.componentId!),\n });\n }\n\n // generate an Animation object for each data object\n const animations = data.map(\n ({ effect, options: effectOptions, id, part }) => {\n const effectTarget = part\n ? element?.querySelector(`[data-motion-part~=\"${part}\"]`) // maybe add ~ here as well\n : element;\n\n const keyframeEffect = new KeyframeEffect(\n effectTarget || null,\n [],\n effectOptions,\n );\n\n // set the keyframes for the KeyframeEffect after measurements and mutations\n fastdom.mutate(() => {\n if ('timing' in effect) {\n keyframeEffect.updateTiming(effect.timing as OptionalEffectTiming);\n }\n\n keyframeEffect.setKeyframes(effect.keyframes);\n });\n\n const animation: Animation =\n isViewProgress && timeline\n ? new Animation(keyframeEffect, timeline as AnimationTimeline)\n : new Animation(keyframeEffect);\n\n // if this is a ScrubAnimation with view-progress trigger and the browser supports the ViewTimeline API\n if (isViewProgress) {\n if (timeline) {\n // set the ranges for the animation after measurements and mutations\n fastdom.mutate(() => {\n const { start, end } = getRanges(effect as AnimationDataForScrub);\n // @ts-expect-error\n animation.rangeStart = start;\n // @ts-expect-error\n animation.rangeEnd = end;\n\n animation.play();\n });\n } else {\n const { startOffset, endOffset } =\n animationOptions as ScrubAnimationOptions;\n\n // set the ranges for the animation after measurements and mutations\n fastdom.mutate(() => {\n const startOffsetToWrite =\n (effect as AnimationDataForScrub).startOffset || startOffset;\n const endOffsetToWrite =\n (effect as AnimationDataForScrub).endOffset || endOffset;\n\n Object.assign(animation, {\n start: {\n name: startOffsetToWrite!.name,\n offset: startOffsetToWrite!.offset?.value,\n add: (effect as AnimationDataForScrub)!.startOffsetAdd,\n },\n end: {\n name: endOffsetToWrite!.name,\n offset: endOffsetToWrite!.offset?.value,\n add: (effect as AnimationDataForScrub)!.endOffsetAdd,\n },\n });\n });\n }\n }\n\n if (id) {\n animation.id = id;\n }\n\n return animation;\n },\n );\n\n // create an AnimationGroup with the generate animations\n return new AnimationGroup(animations, {\n ...animationOptions,\n trigger: { ...(trigger || ({} as Partial<TriggerVariant>)) },\n // make sure the group is ready after all animation targets are measured and mutated\n measured: new Promise((resolve) => fastdom.mutate(resolve)),\n });\n}\n\nexport { getWebAnimation };\n"],"mappings":";;;;;AAWA,IAAAA,eAAA,GAAAC,OAA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AE;cACLc,IAAI,EAAEJ,kBAAkB,CAAEI,IAAI;cAC9BC,MAAM,GAAAP,OAAA,GAAEE,kBAAkB,CAAEK,MAAM,qBAA1BP,OAAA,CAA4BQ,KAAK;cACzCC,GAAG,EAAG7B,MAAM,CAA4B8B;YAC1C,CAAC;YACDjB,GAAG,EAAE;cACHa,IAAI,EAAEH,gBAAgB,CAAEG,IAAI;cAC5BC,MAAM,GAAAN,QAAA,GAAEE,gBAAgB,CAAEI,MAAM,qBAAxBN,QAAA,CAA0BO,KAAK;cACvCC,GAAG,EAAG7B,MAAM,CAA4B+B;YAC1C;UACF,CAAC,CAAC;QACJ,CAAC,CAAC;MACJ;IACF;IAEA,IAAI/C,EAAE,EAAE;MACNtB,SAAS,CAACsB,EAAE,GAAGA,EAAE;IACnB;IAEA,OAAOtB,SAAS;EAClB,CACF,CAAC;;EAED;EACA,OAAO,IAAIsE,8BAAc,CAAClC,UAAU,EAAE;IACpC,GAAGtB,gBAAgB;IACnBC,OAAO,EAAE;MAAE,IAAIA,OAAO,IAAK,CAAC,CAA6B;IAAE,CAAC;IAC5D;IACAwD,QAAQ,EAAE,IAAIC,OAAO,CAAEC,OAAO,IAAK7B,gBAAO,CAACjC,MAAM,CAAC8D,OAAO,CAAC;EAC5D,CAAC,CAAC;AACJ","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_CustomAnimation","require","_AnimationGroup","_common","_fastdom","_interopRequireDefault","getWebAnimationEffect","preset","animation","target","options","type","duration","reducedMotion","iterations","undefined","domApi","HTMLElement","measure","mutate","web","getWebAnimation","animationOptions","trigger","ownerDocument","element","getElement","effectOptions","customEffect","namedEffect","id","mouseAnimationPreset","getNamedEffect","mouseAnimationFactory","animationsData","data","getEffectsData","effectId","timeline","isViewProgress","window","ViewTimeline","subject","componentId","animations","map","effect","part","effectTarget","querySelector","keyframeEffect","KeyframeEffect","fastdom","updateTiming","timing","setKeyframes","keyframes","timingOptions","CustomAnimation","Animation","start","end","getRanges","rangeStart","rangeEnd","play","startOffset","endOffset","_offset","_offset2","startOffsetToWrite","endOffsetToWrite","Object","assign","name","offset","value","add","startOffsetAdd","endOffsetAdd","AnimationGroup","measured","Promise","resolve"],"sources":["../../../src/api/webAnimations.ts"],"sourcesContent":["import type {\n AnimationData,\n AnimationDataForScrub,\n AnimationEffectAPI,\n AnimationOptions,\n MouseAnimationFactory,\n MouseAnimationInstance,\n ScrubAnimationOptions,\n TriggerVariant,\n WebAnimationEffectFactory,\n} from '../types';\nimport { CustomAnimation } from '../CustomAnimation';\nimport { AnimationGroup } from '../AnimationGroup';\nimport {\n getElement,\n measure,\n mutate,\n getRanges,\n getNamedEffect,\n getEffectsData,\n} from './common';\nimport fastdom from 'fastdom';\n\nfunction getWebAnimationEffect(\n preset: AnimationEffectAPI<any> | WebAnimationEffectFactory<any> | null,\n animation: AnimationOptions,\n target: HTMLElement | string | null,\n options?: Record<string, any>,\n): AnimationData[] | MouseAnimationFactory {\n if (preset) {\n // validate duration is a number over 0\n if (animation.type === 'TimeAnimationOptions') {\n animation.duration = animation.duration || 1;\n\n if (options?.reducedMotion) {\n if (animation.iterations === 1 || animation.iterations == undefined) {\n animation = { ...animation, duration: 1 };\n } else {\n return [];\n }\n }\n }\n\n let domApi;\n if (target instanceof HTMLElement) {\n domApi = { measure: measure(target), mutate: mutate(target) };\n }\n\n return (preset as AnimationEffectAPI<any>).web\n ? (preset as AnimationEffectAPI<any>).web(animation, domApi, options)\n : (preset as WebAnimationEffectFactory<any>)(animation, domApi, options);\n }\n\n return [];\n}\n\nfunction getWebAnimation(\n target: HTMLElement | string | null,\n animationOptions: AnimationOptions,\n trigger?: Partial<TriggerVariant> & { element?: HTMLElement },\n options?: Record<string, any>,\n ownerDocument?: Document,\n): AnimationGroup | MouseAnimationInstance {\n const element =\n target instanceof HTMLElement ? target : getElement(target, ownerDocument);\n\n if (trigger?.trigger === 'pointer-move') {\n let effectOptions = animationOptions;\n\n if (animationOptions.customEffect) {\n effectOptions = {\n ...animationOptions,\n namedEffect: { id: '', type: 'CustomMouse' },\n };\n }\n\n // TODO: need to fix the type here, currently lying about the returned type to be WebAnimationEffectFactory instead of MouseAnimationFactoryCreate\n const mouseAnimationPreset = getNamedEffect(\n effectOptions,\n ) as WebAnimationEffectFactory<'scrub'>;\n const mouseAnimationFactory = getWebAnimationEffect(\n mouseAnimationPreset,\n animationOptions,\n element,\n options,\n ) as MouseAnimationFactory;\n\n return mouseAnimationFactory(element as HTMLElement);\n }\n\n // get the preset for the given animation options\n const namedEffect = getNamedEffect(\n animationOptions,\n ) as AnimationEffectAPI<any> | null;\n\n const animationsData = getWebAnimationEffect(\n namedEffect,\n animationOptions,\n element,\n options,\n ) as AnimationData[];\n const data = getEffectsData(animationsData, animationOptions.effectId);\n\n let timeline: typeof window.ViewTimeline | undefined;\n const isViewProgress = trigger?.trigger === 'view-progress';\n\n // if this is a ScrubAnimation with view-progress trigger and the browser supports the ViewTimeline API\n if (isViewProgress && window.ViewTimeline) {\n // generate the timeline object\n // @ts-expect-error\n timeline = new ViewTimeline({\n subject: trigger.element || getElement(trigger.componentId!),\n });\n }\n\n // generate an Animation object for each data object\n const animations = data.map(\n ({ effect, options: effectOptions, id, part }) => {\n const effectTarget = part\n ? element?.querySelector(`[data-motion-part~=\"${part}\"]`) // maybe add ~ here as well\n : element;\n\n const keyframeEffect = new KeyframeEffect(\n effectTarget || null,\n [],\n effectOptions,\n );\n\n // set the keyframes for the KeyframeEffect after measurements and mutations\n fastdom.mutate(() => {\n if ('timing' in effect) {\n keyframeEffect.updateTiming(effect.timing as OptionalEffectTiming);\n }\n\n keyframeEffect.setKeyframes(effect.keyframes);\n });\n\n const timingOptions =\n isViewProgress && timeline\n ? { timeline: timeline as AnimationTimeline }\n : {};\n const animation =\n typeof effect.customEffect === 'function'\n ? (new CustomAnimation(\n effect.customEffect,\n effectTarget || null,\n effectOptions,\n timingOptions,\n ) as Animation)\n : new Animation(keyframeEffect, timingOptions.timeline);\n\n // if this is a ScrubAnimation with view-progress trigger and the browser supports the ViewTimeline API\n if (isViewProgress) {\n if (timeline) {\n // set the ranges for the animation after measurements and mutations\n fastdom.mutate(() => {\n const { start, end } = getRanges(effect as AnimationDataForScrub);\n // @ts-expect-error\n animation.rangeStart = start;\n // @ts-expect-error\n animation.rangeEnd = end;\n\n animation.play();\n });\n } else {\n const { startOffset, endOffset } =\n animationOptions as ScrubAnimationOptions;\n\n // set the ranges for the animation after measurements and mutations\n fastdom.mutate(() => {\n const startOffsetToWrite =\n (effect as AnimationDataForScrub).startOffset || startOffset;\n const endOffsetToWrite =\n (effect as AnimationDataForScrub).endOffset || endOffset;\n\n Object.assign(animation, {\n start: {\n name: startOffsetToWrite!.name,\n offset: startOffsetToWrite!.offset?.value,\n add: (effect as AnimationDataForScrub)!.startOffsetAdd,\n },\n end: {\n name: endOffsetToWrite!.name,\n offset: endOffsetToWrite!.offset?.value,\n add: (effect as AnimationDataForScrub)!.endOffsetAdd,\n },\n });\n });\n }\n }\n\n if (id) {\n animation.id = id;\n }\n\n return animation;\n },\n );\n\n // create an AnimationGroup with the generate animations\n return new AnimationGroup(animations, {\n ...animationOptions,\n trigger: { ...(trigger || ({} as Partial<TriggerVariant>)) },\n // make sure the group is ready after all animation targets are measured and mutated\n measured: new Promise((resolve) => fastdom.mutate(resolve)),\n });\n}\n\nexport { getWebAnimation };\n"],"mappings":";;;;;AAWA,IAAAA,gBAAA,GAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAQA,IAAAG,QAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAEA,SAASK,qBAAqBA,CAC5BC,MAAuE,EACvEC,SAA2B,EAC3BC,MAAmC,EACnCC,OAA6B,EACY;EACzC,IAAIH,MAAM,EAAE;IACV;IACA,IAAIC,SAAS,CAACG,IAAI,KAAK,sBAAsB,EAAE;MAC7CH,SAAS,CAACI,QAAQ,GAAGJ,SAAS,CAACI,QAAQ,IAAI,CAAC;MAE5C,IAAIF,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AAK;cACzCC,GAAG,EAAG/B,MAAM,CAA4BgC;YAC1C,CAAC;YACDjB,GAAG,EAAE;cACHa,IAAI,EAAEH,gBAAgB,CAAEG,IAAI;cAC5BC,MAAM,GAAAN,QAAA,GAAEE,gBAAgB,CAAEI,MAAM,qBAAxBN,QAAA,CAA0BO,KAAK;cACvCC,GAAG,EAAG/B,MAAM,CAA4BiC;YAC1C;UACF,CAAC,CAAC;QACJ,CAAC,CAAC;MACJ;IACF;IAEA,IAAIjD,EAAE,EAAE;MACNtB,SAAS,CAACsB,EAAE,GAAGA,EAAE;IACnB;IAEA,OAAOtB,SAAS;EAClB,CACF,CAAC;;EAED;EACA,OAAO,IAAIwE,8BAAc,CAACpC,UAAU,EAAE;IACpC,GAAGtB,gBAAgB;IACnBC,OAAO,EAAE;MAAE,IAAIA,OAAO,IAAK,CAAC,CAA6B;IAAE,CAAC;IAC5D;IACA0D,QAAQ,EAAE,IAAIC,OAAO,CAAEC,OAAO,IAAK/B,gBAAO,CAACjC,MAAM,CAACgE,OAAO,CAAC;EAC5D,CAAC,CAAC;AACJ","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["CustomMouse","constructor","target","options","_defineProperty2","default","currentProgress","x","y","v","active","play","progress","cancel","getProgress","transition","style","exports","create"],"sources":["../../../../src/library/mouse/CustomMouse.ts"],"sourcesContent":["import type {\n AnimationExtraOptions,\n Progress,\n ScrubAnimationOptions,\n} from '../../types';\n\nexport class CustomMouse {\n target: HTMLElement;\n options: Record<string, any>;\n currentProgress: Progress;\n\n constructor(target: HTMLElement, options?: Record<string, any>) {\n this.target = target;\n this.options = options || {};\n this.currentProgress = { x: 0.5, y: 0.5, v: { x: 0, y: 0 }, active: true };\n\n this.play();\n }\n\n progress({ x, y, v, active }: Progress) {\n this.currentProgress = { x, y, v, active };\n }\n\n cancel() {\n this.currentProgress = { x: 0.5, y: 0.5, v: { x: 0, y: 0 } };\n }\n\n getProgress() {\n return this.currentProgress;\n }\n\n play() {\n if (this.options.transition && this.target) {\n this.target.style.transition = this.options.transition;\n }\n }\n}\n\nexport function create(options: ScrubAnimationOptions & AnimationExtraOptions) {\n return (target: HTMLElement) => new CustomMouse(target, options);\n}\n"],"mappings":";;;;;;;AAMO,MAAMA,WAAW,CAAC;EAKvBC,WAAWA,CAACC,MAAmB,EAAEC,OAA6B,EAAE;IAAA,IAAAC,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAC9D,IAAI,CAACH,MAAM,GAAGA,MAAM;IACpB,IAAI,CAACC,OAAO,GAAGA,OAAO,IAAI,CAAC,CAAC;IAC5B,IAAI,CAACG,eAAe,GAAG;MAAEC,CAAC,EAAE,GAAG;MAAEC,CAAC,EAAE,GAAG;MAAEC,CAAC,EAAE;QAAEF,CAAC,EAAE,CAAC;QAAEC,CAAC,EAAE;MAAE,CAAC;MAAEE,MAAM,EAAE;IAAK,CAAC;IAE1E,IAAI,CAACC,IAAI,CAAC,CAAC;EACb;EAEAC,QAAQA,CAAC;IAAEL,CAAC;IAAEC,CAAC;IAAEC,CAAC;IAAEC;EAAiB,CAAC,EAAE;IACtC,IAAI,CAACJ,eAAe,GAAG;MAAEC,CAAC;MAAEC,CAAC;MAAEC,CAAC;MAAEC;IAAO,CAAC;
|
|
1
|
+
{"version":3,"names":["CustomMouse","constructor","target","options","_defineProperty2","default","currentProgress","x","y","v","active","play","progress","customEffect","cancel","getProgress","transition","style","exports","create"],"sources":["../../../../src/library/mouse/CustomMouse.ts"],"sourcesContent":["import type {\n AnimationExtraOptions,\n Progress,\n ScrubAnimationOptions,\n} from '../../types';\n\nexport class CustomMouse {\n target: HTMLElement;\n options: Record<string, any>;\n currentProgress: Progress;\n\n constructor(target: HTMLElement, options?: Record<string, any>) {\n this.target = target;\n this.options = options || {};\n this.currentProgress = { x: 0.5, y: 0.5, v: { x: 0, y: 0 }, active: true };\n\n this.play();\n }\n\n progress({ x, y, v, active }: Progress) {\n this.currentProgress = { x, y, v, active };\n if (typeof this.options.customEffect === 'function') {\n this.options.customEffect(this.target, this.currentProgress);\n }\n }\n\n cancel() {\n this.currentProgress = { x: 0.5, y: 0.5, v: { x: 0, y: 0 } };\n }\n\n getProgress() {\n return this.currentProgress;\n }\n\n play() {\n if (this.options.transition && this.target) {\n this.target.style.transition = this.options.transition;\n }\n }\n}\n\nexport function create(options: ScrubAnimationOptions & AnimationExtraOptions) {\n return (target: HTMLElement) => new CustomMouse(target, options);\n}\n"],"mappings":";;;;;;;AAMO,MAAMA,WAAW,CAAC;EAKvBC,WAAWA,CAACC,MAAmB,EAAEC,OAA6B,EAAE;IAAA,IAAAC,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAC9D,IAAI,CAACH,MAAM,GAAGA,MAAM;IACpB,IAAI,CAACC,OAAO,GAAGA,OAAO,IAAI,CAAC,CAAC;IAC5B,IAAI,CAACG,eAAe,GAAG;MAAEC,CAAC,EAAE,GAAG;MAAEC,CAAC,EAAE,GAAG;MAAEC,CAAC,EAAE;QAAEF,CAAC,EAAE,CAAC;QAAEC,CAAC,EAAE;MAAE,CAAC;MAAEE,MAAM,EAAE;IAAK,CAAC;IAE1E,IAAI,CAACC,IAAI,CAAC,CAAC;EACb;EAEAC,QAAQA,CAAC;IAAEL,CAAC;IAAEC,CAAC;IAAEC,CAAC;IAAEC;EAAiB,CAAC,EAAE;IACtC,IAAI,CAACJ,eAAe,GAAG;MAAEC,CAAC;MAAEC,CAAC;MAAEC,CAAC;MAAEC;IAAO,CAAC;IAC1C,IAAI,OAAO,IAAI,CAACP,OAAO,CAACU,YAAY,KAAK,UAAU,EAAE;MACnD,IAAI,CAACV,OAAO,CAACU,YAAY,CAAC,IAAI,CAACX,MAAM,EAAE,IAAI,CAACI,eAAe,CAAC;IAC9D;EACF;EAEAQ,MAAMA,CAAA,EAAG;IACP,IAAI,CAACR,eAAe,GAAG;MAAEC,CAAC,EAAE,GAAG;MAAEC,CAAC,EAAE,GAAG;MAAEC,CAAC,EAAE;QAAEF,CAAC,EAAE,CAAC;QAAEC,CAAC,EAAE;MAAE;IAAE,CAAC;EAC9D;EAEAO,WAAWA,CAAA,EAAG;IACZ,OAAO,IAAI,CAACT,eAAe;EAC7B;EAEAK,IAAIA,CAAA,EAAG;IACL,IAAI,IAAI,CAACR,OAAO,CAACa,UAAU,IAAI,IAAI,CAACd,MAAM,EAAE;MAC1C,IAAI,CAACA,MAAM,CAACe,KAAK,CAACD,UAAU,GAAG,IAAI,CAACb,OAAO,CAACa,UAAU;IACxD;EACF;AACF;AAACE,OAAA,CAAAlB,WAAA,GAAAA,WAAA;AAEM,SAASmB,MAAMA,CAAChB,OAAsD,EAAE;EAC7E,OAAQD,MAAmB,IAAK,IAAIF,WAAW,CAACE,MAAM,EAAEC,OAAO,CAAC;AAClE","ignoreList":[]}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
/**
|
|
3
|
+
* @class CustomAnimation
|
|
4
|
+
*
|
|
5
|
+
* A wrapper object for Animation that mimics the same interface but implements CustomEffect that runs JS code instead of KeyframeEffect.
|
|
6
|
+
* The class is implemented by holding an inner Animation object instead of inheritance due to some browsers not allowing extension of built-in objects.
|
|
7
|
+
*/
|
|
8
|
+
export class CustomAnimation {
|
|
9
|
+
constructor(customEffect, target, effectOptions, timingOptions) {
|
|
10
|
+
_defineProperty(this, "_animation", void 0);
|
|
11
|
+
_defineProperty(this, "customEffect", void 0);
|
|
12
|
+
_defineProperty(this, "progress", void 0);
|
|
13
|
+
_defineProperty(this, "_tickCbId", void 0);
|
|
14
|
+
_defineProperty(this, "_finishHandler", void 0);
|
|
15
|
+
// overriding composite so that animation is not replaced and removed
|
|
16
|
+
const effect = new KeyframeEffect(target, [], {
|
|
17
|
+
...effectOptions,
|
|
18
|
+
composite: 'add'
|
|
19
|
+
});
|
|
20
|
+
const {
|
|
21
|
+
timeline
|
|
22
|
+
} = timingOptions;
|
|
23
|
+
this._animation = new Animation(effect, timeline);
|
|
24
|
+
this._tickCbId = null;
|
|
25
|
+
this.progress = null;
|
|
26
|
+
this.customEffect = progress => customEffect(effect.target, progress);
|
|
27
|
+
|
|
28
|
+
// stop loop if animation is removed from the DOM after finish (does not fire 'remove' event)
|
|
29
|
+
this._finishHandler = _ => {
|
|
30
|
+
var _target;
|
|
31
|
+
if (!((_target = this.effect.target) != null && _target.getAnimations().find(a => a === this._animation))) {
|
|
32
|
+
this.cancel();
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
this.addEventListener('finish', this._finishHandler);
|
|
36
|
+
this.addEventListener('remove', this._finishHandler);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// private tick method for customEffect loop implementation
|
|
40
|
+
_tick() {
|
|
41
|
+
try {
|
|
42
|
+
var _this$effect;
|
|
43
|
+
const progress = ((_this$effect = this.effect) == null ? void 0 : _this$effect.getComputedTiming().progress) ?? null;
|
|
44
|
+
if (progress !== this.progress) {
|
|
45
|
+
var _this$customEffect;
|
|
46
|
+
(_this$customEffect = this.customEffect) == null || _this$customEffect.call(this, progress);
|
|
47
|
+
this.progress = progress;
|
|
48
|
+
}
|
|
49
|
+
this._tickCbId = requestAnimationFrame(() => {
|
|
50
|
+
this._tick();
|
|
51
|
+
});
|
|
52
|
+
} catch (error) {
|
|
53
|
+
this._tickCbId = null;
|
|
54
|
+
console.error(`failed to run customEffect! effectId: ${this.id}, error: ${error instanceof Error ? error.message : error}`);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Animation timing properties
|
|
59
|
+
get currentTime() {
|
|
60
|
+
return this._animation.currentTime;
|
|
61
|
+
}
|
|
62
|
+
set currentTime(time) {
|
|
63
|
+
this._animation.currentTime = time;
|
|
64
|
+
}
|
|
65
|
+
get startTime() {
|
|
66
|
+
return this._animation.startTime;
|
|
67
|
+
}
|
|
68
|
+
set startTime(time) {
|
|
69
|
+
this._animation.startTime = time;
|
|
70
|
+
}
|
|
71
|
+
get playbackRate() {
|
|
72
|
+
return this._animation.playbackRate;
|
|
73
|
+
}
|
|
74
|
+
set playbackRate(speed) {
|
|
75
|
+
this._animation.playbackRate = speed;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Animation basic properties
|
|
79
|
+
get id() {
|
|
80
|
+
return this._animation.id;
|
|
81
|
+
}
|
|
82
|
+
set id(uid) {
|
|
83
|
+
this._animation.id = uid;
|
|
84
|
+
}
|
|
85
|
+
get effect() {
|
|
86
|
+
return this._animation.effect;
|
|
87
|
+
}
|
|
88
|
+
set effect(e) {
|
|
89
|
+
this._animation.effect = e;
|
|
90
|
+
}
|
|
91
|
+
get timeline() {
|
|
92
|
+
return this._animation.timeline;
|
|
93
|
+
}
|
|
94
|
+
set timeline(tl) {
|
|
95
|
+
this._animation.timeline = tl;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Animation readonly state properties
|
|
99
|
+
get finished() {
|
|
100
|
+
return this._animation.finished;
|
|
101
|
+
}
|
|
102
|
+
get pending() {
|
|
103
|
+
return this._animation.pending;
|
|
104
|
+
}
|
|
105
|
+
get playState() {
|
|
106
|
+
return this._animation.playState;
|
|
107
|
+
}
|
|
108
|
+
get ready() {
|
|
109
|
+
return this._animation.ready;
|
|
110
|
+
}
|
|
111
|
+
get replaceState() {
|
|
112
|
+
return this._animation.replaceState;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// Animation event handlers
|
|
116
|
+
get oncancel() {
|
|
117
|
+
return this._animation.oncancel;
|
|
118
|
+
}
|
|
119
|
+
set oncancel(cb) {
|
|
120
|
+
this._animation.oncancel = cb;
|
|
121
|
+
}
|
|
122
|
+
get onfinish() {
|
|
123
|
+
return this._animation.onfinish;
|
|
124
|
+
}
|
|
125
|
+
set onfinish(cb) {
|
|
126
|
+
this._animation.onfinish = cb;
|
|
127
|
+
}
|
|
128
|
+
get onremove() {
|
|
129
|
+
return this._animation.onremove;
|
|
130
|
+
}
|
|
131
|
+
set onremove(cb) {
|
|
132
|
+
this._animation.onremove = cb;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// CustomAnimation overridden methods
|
|
136
|
+
play() {
|
|
137
|
+
this._animation.play();
|
|
138
|
+
cancelAnimationFrame(this._tickCbId);
|
|
139
|
+
this._tickCbId = requestAnimationFrame(() => this._tick());
|
|
140
|
+
}
|
|
141
|
+
pause() {
|
|
142
|
+
this._animation.pause();
|
|
143
|
+
cancelAnimationFrame(this._tickCbId);
|
|
144
|
+
this._tickCbId = null;
|
|
145
|
+
}
|
|
146
|
+
cancel() {
|
|
147
|
+
this.removeEventListener('finish', this._finishHandler);
|
|
148
|
+
this.removeEventListener('remove', this._finishHandler);
|
|
149
|
+
this._animation.cancel();
|
|
150
|
+
// signaling cancelation for customEffect to handle it as desired
|
|
151
|
+
this.customEffect(null);
|
|
152
|
+
cancelAnimationFrame(this._tickCbId);
|
|
153
|
+
this._tickCbId = null;
|
|
154
|
+
}
|
|
155
|
+
commitStyles() {
|
|
156
|
+
console.warn('CustomEffect animations do not support commitStyles method as they have no style to commit');
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// Animation methods without override
|
|
160
|
+
finish() {
|
|
161
|
+
this._animation.finish();
|
|
162
|
+
}
|
|
163
|
+
persist() {
|
|
164
|
+
this._animation.persist();
|
|
165
|
+
}
|
|
166
|
+
reverse() {
|
|
167
|
+
this._animation.reverse();
|
|
168
|
+
}
|
|
169
|
+
updatePlaybackRate(playbackRate) {
|
|
170
|
+
this._animation.updatePlaybackRate(playbackRate);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// Animation events API
|
|
174
|
+
addEventListener(type, listener, options) {
|
|
175
|
+
this._animation.addEventListener(type, listener, options);
|
|
176
|
+
}
|
|
177
|
+
removeEventListener(type, listener, options) {
|
|
178
|
+
this._animation.removeEventListener(type, listener, options);
|
|
179
|
+
}
|
|
180
|
+
dispatchEvent(event) {
|
|
181
|
+
return this._animation.dispatchEvent(event);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
//# sourceMappingURL=CustomAnimation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["CustomAnimation","constructor","customEffect","target","effectOptions","timingOptions","_defineProperty","effect","KeyframeEffect","composite","timeline","_animation","Animation","_tickCbId","progress","_finishHandler","_","_target","getAnimations","find","a","cancel","addEventListener","_tick","_this$effect","getComputedTiming","_this$customEffect","call","requestAnimationFrame","error","console","id","Error","message","currentTime","time","startTime","playbackRate","speed","uid","e","tl","finished","pending","playState","ready","replaceState","oncancel","cb","onfinish","onremove","play","cancelAnimationFrame","pause","removeEventListener","commitStyles","warn","finish","persist","reverse","updatePlaybackRate","type","listener","options","dispatchEvent","event"],"sources":["../../src/CustomAnimation.ts"],"sourcesContent":["/**\n * @class CustomAnimation\n *\n * A wrapper object for Animation that mimics the same interface but implements CustomEffect that runs JS code instead of KeyframeEffect.\n * The class is implemented by holding an inner Animation object instead of inheritance due to some browsers not allowing extension of built-in objects.\n */\nexport class CustomAnimation {\n _animation: Animation;\n customEffect: (progress: number | null) => void;\n progress: number | null;\n _tickCbId: number | null;\n _finishHandler: (_: any) => void;\n\n constructor(\n customEffect: (element: Element | null, progress: number | null) => void,\n target: Element | null,\n effectOptions: KeyframeEffectOptions,\n timingOptions: { timeline?: AnimationTimeline | null },\n ) {\n // overriding composite so that animation is not replaced and removed\n const effect = new KeyframeEffect(target, [], {\n ...effectOptions,\n composite: 'add',\n });\n const { timeline } = timingOptions;\n this._animation = new Animation(effect, timeline);\n\n this._tickCbId = null;\n this.progress = null;\n this.customEffect = (progress: number | null) =>\n customEffect(effect.target, progress);\n\n // stop loop if animation is removed from the DOM after finish (does not fire 'remove' event)\n this._finishHandler = (_: any) => {\n if (\n !(this.effect as KeyframeEffect).target\n ?.getAnimations()\n .find((a) => a === this._animation)\n ) {\n this.cancel();\n }\n };\n this.addEventListener('finish', this._finishHandler);\n this.addEventListener('remove', this._finishHandler);\n }\n\n // private tick method for customEffect loop implementation\n private _tick() {\n try {\n const progress = this.effect?.getComputedTiming().progress ?? null;\n if (progress !== this.progress) {\n this.customEffect?.(progress);\n this.progress = progress;\n }\n this._tickCbId = requestAnimationFrame(() => {\n this._tick();\n });\n } catch (error) {\n this._tickCbId = null;\n console.error(\n `failed to run customEffect! effectId: ${this.id}, error: ${\n error instanceof Error ? error.message : error\n }`,\n );\n }\n }\n\n // Animation timing properties\n get currentTime() {\n return this._animation.currentTime;\n }\n set currentTime(time: CSSNumberish | null) {\n this._animation.currentTime = time;\n }\n get startTime() {\n return this._animation.startTime;\n }\n set startTime(time: CSSNumberish | null) {\n this._animation.startTime = time;\n }\n get playbackRate() {\n return this._animation.playbackRate;\n }\n set playbackRate(speed: number) {\n this._animation.playbackRate = speed;\n }\n\n // Animation basic properties\n get id() {\n return this._animation.id;\n }\n set id(uid: string) {\n this._animation.id = uid;\n }\n get effect() {\n return this._animation.effect;\n }\n set effect(e: AnimationEffect | null) {\n this._animation.effect = e;\n }\n get timeline() {\n return this._animation.timeline;\n }\n set timeline(tl: AnimationTimeline | null) {\n this._animation.timeline = tl;\n }\n\n // Animation readonly state properties\n get finished() {\n return this._animation.finished;\n }\n get pending() {\n return this._animation.pending;\n }\n get playState() {\n return this._animation.playState;\n }\n get ready() {\n return this._animation.ready;\n }\n get replaceState() {\n return this._animation.replaceState;\n }\n\n // Animation event handlers\n get oncancel() {\n return this._animation.oncancel;\n }\n set oncancel(\n cb: ((this: Animation, ev: AnimationPlaybackEvent) => any) | null,\n ) {\n this._animation.oncancel = cb;\n }\n get onfinish() {\n return this._animation.onfinish;\n }\n set onfinish(\n cb: ((this: Animation, ev: AnimationPlaybackEvent) => any) | null,\n ) {\n this._animation.onfinish = cb;\n }\n get onremove() {\n return this._animation.onremove;\n }\n set onremove(cb: ((this: Animation, ev: Event) => any) | null) {\n this._animation.onremove = cb;\n }\n\n // CustomAnimation overridden methods\n play() {\n this._animation.play();\n cancelAnimationFrame(this._tickCbId!);\n this._tickCbId = requestAnimationFrame(() => this._tick());\n }\n\n pause() {\n this._animation.pause();\n cancelAnimationFrame(this._tickCbId!);\n this._tickCbId = null;\n }\n\n cancel() {\n this.removeEventListener('finish', this._finishHandler);\n this.removeEventListener('remove', this._finishHandler);\n this._animation.cancel();\n // signaling cancelation for customEffect to handle it as desired\n this.customEffect(null);\n cancelAnimationFrame(this._tickCbId!);\n this._tickCbId = null;\n }\n\n commitStyles() {\n console.warn(\n 'CustomEffect animations do not support commitStyles method as they have no style to commit',\n );\n }\n\n // Animation methods without override\n finish() {\n this._animation.finish();\n }\n persist() {\n this._animation.persist();\n }\n reverse() {\n this._animation.reverse();\n }\n updatePlaybackRate(playbackRate: number) {\n this._animation.updatePlaybackRate(playbackRate);\n }\n\n // Animation events API\n addEventListener(\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | AddEventListenerOptions,\n ) {\n this._animation.addEventListener(type, listener, options);\n }\n removeEventListener(\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | AddEventListenerOptions,\n ) {\n this._animation.removeEventListener(type, listener, options);\n }\n dispatchEvent(event: Event) {\n return this._animation.dispatchEvent(event);\n }\n}\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,eAAe,CAAC;EAO3BC,WAAWA,CACTC,YAAwE,EACxEC,MAAsB,EACtBC,aAAoC,EACpCC,aAAsD,EACtD;IAAAC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IACA;IACA,MAAMC,MAAM,GAAG,IAAIC,cAAc,CAACL,MAAM,EAAE,EAAE,EAAE;MAC5C,GAAGC,aAAa;MAChBK,SAAS,EAAE;IACb,CAAC,CAAC;IACF,MAAM;MAAEC;IAAS,CAAC,GAAGL,aAAa;IAClC,IAAI,CAACM,UAAU,GAAG,IAAIC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C,QAAQ,EAAEC,OAAO,CAAC;EAC9D;EACAC,aAAaA,CAACC,KAAY,EAAE;IAC1B,OAAO,IAAI,CAACtD,UAAU,CAACqD,aAAa,CAACC,KAAK,CAAC;EAC7C;AACF","ignoreList":[]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CustomAnimation } from '../CustomAnimation';
|
|
1
2
|
import { AnimationGroup } from '../AnimationGroup';
|
|
2
3
|
import { getElement, measure, mutate, getRanges, getNamedEffect, getEffectsData } from './common';
|
|
3
4
|
import fastdom from 'fastdom';
|
|
@@ -83,7 +84,10 @@ function getWebAnimation(target, animationOptions, trigger, options, ownerDocume
|
|
|
83
84
|
}
|
|
84
85
|
keyframeEffect.setKeyframes(effect.keyframes);
|
|
85
86
|
});
|
|
86
|
-
const
|
|
87
|
+
const timingOptions = isViewProgress && timeline ? {
|
|
88
|
+
timeline: timeline
|
|
89
|
+
} : {};
|
|
90
|
+
const animation = typeof effect.customEffect === 'function' ? new CustomAnimation(effect.customEffect, effectTarget || null, effectOptions, timingOptions) : new Animation(keyframeEffect, timingOptions.timeline);
|
|
87
91
|
|
|
88
92
|
// if this is a ScrubAnimation with view-progress trigger and the browser supports the ViewTimeline API
|
|
89
93
|
if (isViewProgress) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["AnimationGroup","getElement","measure","mutate","getRanges","getNamedEffect","getEffectsData","fastdom","getWebAnimationEffect","preset","animation","target","options","type","duration","reducedMotion","iterations","undefined","domApi","HTMLElement","web","getWebAnimation","animationOptions","trigger","ownerDocument","element","effectOptions","customEffect","namedEffect","id","mouseAnimationPreset","mouseAnimationFactory","animationsData","data","effectId","timeline","isViewProgress","window","ViewTimeline","subject","componentId","animations","map","_ref","effect","part","effectTarget","querySelector","keyframeEffect","KeyframeEffect","updateTiming","timing","setKeyframes","keyframes","Animation","start","end","rangeStart","rangeEnd","play","startOffset","endOffset","_offset","_offset2","startOffsetToWrite","endOffsetToWrite","Object","assign","name","offset","value","add","startOffsetAdd","endOffsetAdd","measured","Promise","resolve"],"sources":["../../../src/api/webAnimations.ts"],"sourcesContent":["import type {\n AnimationData,\n AnimationDataForScrub,\n AnimationEffectAPI,\n AnimationOptions,\n MouseAnimationFactory,\n MouseAnimationInstance,\n ScrubAnimationOptions,\n TriggerVariant,\n WebAnimationEffectFactory,\n} from '../types';\nimport { AnimationGroup } from '../AnimationGroup';\nimport {\n getElement,\n measure,\n mutate,\n getRanges,\n getNamedEffect,\n getEffectsData,\n} from './common';\nimport fastdom from 'fastdom';\n\nfunction getWebAnimationEffect(\n preset: AnimationEffectAPI<any> | WebAnimationEffectFactory<any> | null,\n animation: AnimationOptions,\n target: HTMLElement | string | null,\n options?: Record<string, any>,\n): AnimationData[] | MouseAnimationFactory {\n if (preset) {\n // validate duration is a number over 0\n if (animation.type === 'TimeAnimationOptions') {\n animation.duration = animation.duration || 1;\n\n if (options?.reducedMotion) {\n if (animation.iterations === 1 || animation.iterations == undefined) {\n animation = { ...animation, duration: 1 };\n } else {\n return [];\n }\n }\n }\n\n let domApi;\n if (target instanceof HTMLElement) {\n domApi = { measure: measure(target), mutate: mutate(target) };\n }\n\n return (preset as AnimationEffectAPI<any>).web\n ? (preset as AnimationEffectAPI<any>).web(animation, domApi, options)\n : (preset as WebAnimationEffectFactory<any>)(animation, domApi, options);\n }\n\n return [];\n}\n\nfunction getWebAnimation(\n target: HTMLElement | string | null,\n animationOptions: AnimationOptions,\n trigger?: Partial<TriggerVariant> & { element?: HTMLElement },\n options?: Record<string, any>,\n ownerDocument?: Document,\n): AnimationGroup | MouseAnimationInstance {\n const element =\n target instanceof HTMLElement ? target : getElement(target, ownerDocument);\n\n if (trigger?.trigger === 'pointer-move') {\n let effectOptions = animationOptions;\n\n if (animationOptions.customEffect) {\n effectOptions = {\n ...animationOptions,\n namedEffect: { id: '', type: 'CustomMouse' },\n };\n }\n\n // TODO: need to fix the type here, currently lying about the returned type to be WebAnimationEffectFactory instead of MouseAnimationFactoryCreate\n const mouseAnimationPreset = getNamedEffect(\n effectOptions,\n ) as WebAnimationEffectFactory<'scrub'>;\n const mouseAnimationFactory = getWebAnimationEffect(\n mouseAnimationPreset,\n animationOptions,\n element,\n options,\n ) as MouseAnimationFactory;\n\n return mouseAnimationFactory(element as HTMLElement);\n }\n\n // get the preset for the given animation options\n const namedEffect = getNamedEffect(\n animationOptions,\n ) as AnimationEffectAPI<any> | null;\n\n const animationsData = getWebAnimationEffect(\n namedEffect,\n animationOptions,\n element,\n options,\n ) as AnimationData[];\n const data = getEffectsData(animationsData, animationOptions.effectId);\n\n let timeline: typeof window.ViewTimeline | undefined;\n const isViewProgress = trigger?.trigger === 'view-progress';\n\n // if this is a ScrubAnimation with view-progress trigger and the browser supports the ViewTimeline API\n if (isViewProgress && window.ViewTimeline) {\n // generate the timeline object\n // @ts-expect-error\n timeline = new ViewTimeline({\n subject: trigger.element || getElement(trigger.componentId!),\n });\n }\n\n // generate an Animation object for each data object\n const animations = data.map(\n ({ effect, options: effectOptions, id, part }) => {\n const effectTarget = part\n ? element?.querySelector(`[data-motion-part~=\"${part}\"]`) // maybe add ~ here as well\n : element;\n\n const keyframeEffect = new KeyframeEffect(\n effectTarget || null,\n [],\n effectOptions,\n );\n\n // set the keyframes for the KeyframeEffect after measurements and mutations\n fastdom.mutate(() => {\n if ('timing' in effect) {\n keyframeEffect.updateTiming(effect.timing as OptionalEffectTiming);\n }\n\n keyframeEffect.setKeyframes(effect.keyframes);\n });\n\n const animation: Animation =\n isViewProgress && timeline\n ? new Animation(keyframeEffect, timeline as AnimationTimeline)\n : new Animation(keyframeEffect);\n\n // if this is a ScrubAnimation with view-progress trigger and the browser supports the ViewTimeline API\n if (isViewProgress) {\n if (timeline) {\n // set the ranges for the animation after measurements and mutations\n fastdom.mutate(() => {\n const { start, end } = getRanges(effect as AnimationDataForScrub);\n // @ts-expect-error\n animation.rangeStart = start;\n // @ts-expect-error\n animation.rangeEnd = end;\n\n animation.play();\n });\n } else {\n const { startOffset, endOffset } =\n animationOptions as ScrubAnimationOptions;\n\n // set the ranges for the animation after measurements and mutations\n fastdom.mutate(() => {\n const startOffsetToWrite =\n (effect as AnimationDataForScrub).startOffset || startOffset;\n const endOffsetToWrite =\n (effect as AnimationDataForScrub).endOffset || endOffset;\n\n Object.assign(animation, {\n start: {\n name: startOffsetToWrite!.name,\n offset: startOffsetToWrite!.offset?.value,\n add: (effect as AnimationDataForScrub)!.startOffsetAdd,\n },\n end: {\n name: endOffsetToWrite!.name,\n offset: endOffsetToWrite!.offset?.value,\n add: (effect as AnimationDataForScrub)!.endOffsetAdd,\n },\n });\n });\n }\n }\n\n if (id) {\n animation.id = id;\n }\n\n return animation;\n },\n );\n\n // create an AnimationGroup with the generate animations\n return new AnimationGroup(animations, {\n ...animationOptions,\n trigger: { ...(trigger || ({} as Partial<TriggerVariant>)) },\n // make sure the group is ready after all animation targets are measured and mutated\n measured: new Promise((resolve) => fastdom.mutate(resolve)),\n });\n}\n\nexport { getWebAnimation };\n"],"mappings":"AAWA,SAASA,cAAc,QAAQ,mBAAmB;AAClD,SACEC,UAAU,EACVC,OAAO,EACPC,MAAM,EACNC,SAAS,EACTC,cAAc,EACdC,cAAc,QACT,UAAU;AACjB,OAAOC,OAAO,MAAM,SAAS;AAE7B,SAASC,qBAAqBA,CAC5BC,MAAuE,EACvEC,SAA2B,EAC3BC,MAAmC,EACnCC,OAA6B,EACY;EACzC,IAAIH,MAAM,EAAE;IACV;IACA,IAAIC,SAAS,CAACG,IAAI,KAAK,sBAAsB,EAAE;MAC7CH,SAAS,CAACI,QAAQ,GAAGJ,SAAS,CAACI,QAAQ,IAAI,CAAC;MAE5C,IAAIF,OAAO,YAAPA,OAAO,CAAEG,aAAa,EAAE;QAC1B,IAAIL,SAAS,CAACM,UAAU,KAAK,CAAC,IAAIN,SAAS,CAACM,UAAU,IAAIC,SAAS,EAAE;UACnEP,SAAS,GAAG;YAAE,GAAGA,SAAS;YAAEI,QAAQ,EAAE;UAAE,CAAC;QAC3C,C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yC,UAAU,EAAE;IACpC,GAAGnB,gBAAgB;IACnBC,OAAO,EAAE;MAAE,IAAIA,OAAO,IAAK,CAAC,CAA6B;IAAE,CAAC;IAC5D;IACAmD,QAAQ,EAAE,IAAIC,OAAO,CAAEC,OAAO,IAAKrE,OAAO,CAACJ,MAAM,CAACyE,OAAO,CAAC;EAC5D,CAAC,CAAC;AACJ;AAEA,SAASvD,eAAe","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["CustomAnimation","AnimationGroup","getElement","measure","mutate","getRanges","getNamedEffect","getEffectsData","fastdom","getWebAnimationEffect","preset","animation","target","options","type","duration","reducedMotion","iterations","undefined","domApi","HTMLElement","web","getWebAnimation","animationOptions","trigger","ownerDocument","element","effectOptions","customEffect","namedEffect","id","mouseAnimationPreset","mouseAnimationFactory","animationsData","data","effectId","timeline","isViewProgress","window","ViewTimeline","subject","componentId","animations","map","_ref","effect","part","effectTarget","querySelector","keyframeEffect","KeyframeEffect","updateTiming","timing","setKeyframes","keyframes","timingOptions","Animation","start","end","rangeStart","rangeEnd","play","startOffset","endOffset","_offset","_offset2","startOffsetToWrite","endOffsetToWrite","Object","assign","name","offset","value","add","startOffsetAdd","endOffsetAdd","measured","Promise","resolve"],"sources":["../../../src/api/webAnimations.ts"],"sourcesContent":["import type {\n AnimationData,\n AnimationDataForScrub,\n AnimationEffectAPI,\n AnimationOptions,\n MouseAnimationFactory,\n MouseAnimationInstance,\n ScrubAnimationOptions,\n TriggerVariant,\n WebAnimationEffectFactory,\n} from '../types';\nimport { CustomAnimation } from '../CustomAnimation';\nimport { AnimationGroup } from '../AnimationGroup';\nimport {\n getElement,\n measure,\n mutate,\n getRanges,\n getNamedEffect,\n getEffectsData,\n} from './common';\nimport fastdom from 'fastdom';\n\nfunction getWebAnimationEffect(\n preset: AnimationEffectAPI<any> | WebAnimationEffectFactory<any> | null,\n animation: AnimationOptions,\n target: HTMLElement | string | null,\n options?: Record<string, any>,\n): AnimationData[] | MouseAnimationFactory {\n if (preset) {\n // validate duration is a number over 0\n if (animation.type === 'TimeAnimationOptions') {\n animation.duration = animation.duration || 1;\n\n if (options?.reducedMotion) {\n if (animation.iterations === 1 || animation.iterations == undefined) {\n animation = { ...animation, duration: 1 };\n } else {\n return [];\n }\n }\n }\n\n let domApi;\n if (target instanceof HTMLElement) {\n domApi = { measure: measure(target), mutate: mutate(target) };\n }\n\n return (preset as AnimationEffectAPI<any>).web\n ? (preset as AnimationEffectAPI<any>).web(animation, domApi, options)\n : (preset as WebAnimationEffectFactory<any>)(animation, domApi, options);\n }\n\n return [];\n}\n\nfunction getWebAnimation(\n target: HTMLElement | string | null,\n animationOptions: AnimationOptions,\n trigger?: Partial<TriggerVariant> & { element?: HTMLElement },\n options?: Record<string, any>,\n ownerDocument?: Document,\n): AnimationGroup | MouseAnimationInstance {\n const element =\n target instanceof HTMLElement ? target : getElement(target, ownerDocument);\n\n if (trigger?.trigger === 'pointer-move') {\n let effectOptions = animationOptions;\n\n if (animationOptions.customEffect) {\n effectOptions = {\n ...animationOptions,\n namedEffect: { id: '', type: 'CustomMouse' },\n };\n }\n\n // TODO: need to fix the type here, currently lying about the returned type to be WebAnimationEffectFactory instead of MouseAnimationFactoryCreate\n const mouseAnimationPreset = getNamedEffect(\n effectOptions,\n ) as WebAnimationEffectFactory<'scrub'>;\n const mouseAnimationFactory = getWebAnimationEffect(\n mouseAnimationPreset,\n animationOptions,\n element,\n options,\n ) as MouseAnimationFactory;\n\n return mouseAnimationFactory(element as HTMLElement);\n }\n\n // get the preset for the given animation options\n const namedEffect = getNamedEffect(\n animationOptions,\n ) as AnimationEffectAPI<any> | null;\n\n const animationsData = getWebAnimationEffect(\n namedEffect,\n animationOptions,\n element,\n options,\n ) as AnimationData[];\n const data = getEffectsData(animationsData, animationOptions.effectId);\n\n let timeline: typeof window.ViewTimeline | undefined;\n const isViewProgress = trigger?.trigger === 'view-progress';\n\n // if this is a ScrubAnimation with view-progress trigger and the browser supports the ViewTimeline API\n if (isViewProgress && window.ViewTimeline) {\n // generate the timeline object\n // @ts-expect-error\n timeline = new ViewTimeline({\n subject: trigger.element || getElement(trigger.componentId!),\n });\n }\n\n // generate an Animation object for each data object\n const animations = data.map(\n ({ effect, options: effectOptions, id, part }) => {\n const effectTarget = part\n ? element?.querySelector(`[data-motion-part~=\"${part}\"]`) // maybe add ~ here as well\n : element;\n\n const keyframeEffect = new KeyframeEffect(\n effectTarget || null,\n [],\n effectOptions,\n );\n\n // set the keyframes for the KeyframeEffect after measurements and mutations\n fastdom.mutate(() => {\n if ('timing' in effect) {\n keyframeEffect.updateTiming(effect.timing as OptionalEffectTiming);\n }\n\n keyframeEffect.setKeyframes(effect.keyframes);\n });\n\n const timingOptions =\n isViewProgress && timeline\n ? { timeline: timeline as AnimationTimeline }\n : {};\n const animation =\n typeof effect.customEffect === 'function'\n ? (new CustomAnimation(\n effect.customEffect,\n effectTarget || null,\n effectOptions,\n timingOptions,\n ) as Animation)\n : new Animation(keyframeEffect, timingOptions.timeline);\n\n // if this is a ScrubAnimation with view-progress trigger and the browser supports the ViewTimeline API\n if (isViewProgress) {\n if (timeline) {\n // set the ranges for the animation after measurements and mutations\n fastdom.mutate(() => {\n const { start, end } = getRanges(effect as AnimationDataForScrub);\n // @ts-expect-error\n animation.rangeStart = start;\n // @ts-expect-error\n animation.rangeEnd = end;\n\n animation.play();\n });\n } else {\n const { startOffset, endOffset } =\n animationOptions as ScrubAnimationOptions;\n\n // set the ranges for the animation after measurements and mutations\n fastdom.mutate(() => {\n const startOffsetToWrite =\n (effect as AnimationDataForScrub).startOffset || startOffset;\n const endOffsetToWrite =\n (effect as AnimationDataForScrub).endOffset || endOffset;\n\n Object.assign(animation, {\n start: {\n name: startOffsetToWrite!.name,\n offset: startOffsetToWrite!.offset?.value,\n add: (effect as AnimationDataForScrub)!.startOffsetAdd,\n },\n end: {\n name: endOffsetToWrite!.name,\n offset: endOffsetToWrite!.offset?.value,\n add: (effect as AnimationDataForScrub)!.endOffsetAdd,\n },\n });\n });\n }\n }\n\n if (id) {\n animation.id = id;\n }\n\n return animation;\n },\n );\n\n // create an AnimationGroup with the generate animations\n return new AnimationGroup(animations, {\n ...animationOptions,\n trigger: { ...(trigger || ({} as Partial<TriggerVariant>)) },\n // make sure the group is ready after all animation targets are measured and mutated\n measured: new Promise((resolve) => fastdom.mutate(resolve)),\n });\n}\n\nexport { getWebAnimation };\n"],"mappings":"AAWA,SAASA,eAAe,QAAQ,oBAAoB;AACpD,SAASC,cAAc,QAAQ,mBAAmB;AAClD,SACEC,UAAU,EACVC,OAAO,EACPC,MAAM,EACNC,SAAS,EACTC,cAAc,EACdC,cAAc,QACT,UAAU;AACjB,OAAOC,OAAO,MAAM,SAAS;AAE7B,SAASC,qBAAqBA,CAC5BC,MAAuE,EACvEC,SAA2B,EAC3BC,MAAmC,EACnCC,OAA6B,EACY;EACzC,IAAIH,MAAM,EAAE;IACV;IACA,IAAIC,SAAS,CAACG,IAAI,KAAK,sBAAsB,EAAE;MAC7CH,SAAS,CAACI,QAAQ,GAAGJ,SAAS,CAACI,QAAQ,IAAI,CAAC;MAE5C,IAAIF,OAAO,YAAPA,OAAO,CAAEG,aAAa,EAAE;QAC1B,IAAIL,SAAS,CAACM,UAAU,KAAK,CAAC,IAAIN,SAAS,CAACM,UAAU,IAAIC,SAAS,EAAE;UACnEP,SAAS,GAAG;YAAE,GAAGA,SAAS;YAAEI,QAAQ,EAAE;UAAE,CAAC;QAC3C,CAAC,MAAM;UACL,OAAO,EAAE;QACX;MACF;IACF;IAEA,IAAII,MAAM;IACV,IAAIP,MAAM,YAAYQ,WAAW,EAAE;MACjCD,MAAM,GAAG;QAAEhB,OAAO,EAAEA,OAAO,CAACS,MAAM,CAAC;QAAER,MAAM,EAAEA,MAAM,CAACQ,MAAM;MAAE,CAAC;IAC/D;IAEA,OAAQF,MAAM,CAA6BW,GAAG,GACzCX,MAAM,CAA6BW,GAAG,CAACV,SAAS,EAAEQ,MAAM,EAAEN,OAAO,CAAC,GAClEH,MAAM,CAA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AAO,CAAEC,OAAO,IAAKtE,OAAO,CAACJ,MAAM,CAAC0E,OAAO,CAAC;EAC5D,CAAC,CAAC;AACJ;AAEA,SAASxD,eAAe","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["CustomMouse","constructor","target","options","_defineProperty","currentProgress","x","y","v","active","play","progress","_ref","cancel","getProgress","transition","style","create"],"sources":["../../../../src/library/mouse/CustomMouse.ts"],"sourcesContent":["import type {\n AnimationExtraOptions,\n Progress,\n ScrubAnimationOptions,\n} from '../../types';\n\nexport class CustomMouse {\n target: HTMLElement;\n options: Record<string, any>;\n currentProgress: Progress;\n\n constructor(target: HTMLElement, options?: Record<string, any>) {\n this.target = target;\n this.options = options || {};\n this.currentProgress = { x: 0.5, y: 0.5, v: { x: 0, y: 0 }, active: true };\n\n this.play();\n }\n\n progress({ x, y, v, active }: Progress) {\n this.currentProgress = { x, y, v, active };\n }\n\n cancel() {\n this.currentProgress = { x: 0.5, y: 0.5, v: { x: 0, y: 0 } };\n }\n\n getProgress() {\n return this.currentProgress;\n }\n\n play() {\n if (this.options.transition && this.target) {\n this.target.style.transition = this.options.transition;\n }\n }\n}\n\nexport function create(options: ScrubAnimationOptions & AnimationExtraOptions) {\n return (target: HTMLElement) => new CustomMouse(target, options);\n}\n"],"mappings":";AAMA,OAAO,MAAMA,WAAW,CAAC;EAKvBC,WAAWA,CAACC,MAAmB,EAAEC,OAA6B,EAAE;IAAAC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAC9D,IAAI,CAACF,MAAM,GAAGA,MAAM;IACpB,IAAI,CAACC,OAAO,GAAGA,OAAO,IAAI,CAAC,CAAC;IAC5B,IAAI,CAACE,eAAe,GAAG;MAAEC,CAAC,EAAE,GAAG;MAAEC,CAAC,EAAE,GAAG;MAAEC,CAAC,EAAE;QAAEF,CAAC,EAAE,CAAC;QAAEC,CAAC,EAAE;MAAE,CAAC;MAAEE,MAAM,EAAE;IAAK,CAAC;IAE1E,IAAI,CAACC,IAAI,CAAC,CAAC;EACb;EAEAC,QAAQA,CAAAC,IAAA,EAAgC;IAAA,IAA/B;MAAEN,CAAC;MAAEC,CAAC;MAAEC,CAAC;MAAEC;IAAiB,CAAC,GAAAG,IAAA;IACpC,IAAI,CAACP,eAAe,GAAG;MAAEC,CAAC;MAAEC,CAAC;MAAEC,CAAC;MAAEC;IAAO,CAAC;
|
|
1
|
+
{"version":3,"names":["CustomMouse","constructor","target","options","_defineProperty","currentProgress","x","y","v","active","play","progress","_ref","customEffect","cancel","getProgress","transition","style","create"],"sources":["../../../../src/library/mouse/CustomMouse.ts"],"sourcesContent":["import type {\n AnimationExtraOptions,\n Progress,\n ScrubAnimationOptions,\n} from '../../types';\n\nexport class CustomMouse {\n target: HTMLElement;\n options: Record<string, any>;\n currentProgress: Progress;\n\n constructor(target: HTMLElement, options?: Record<string, any>) {\n this.target = target;\n this.options = options || {};\n this.currentProgress = { x: 0.5, y: 0.5, v: { x: 0, y: 0 }, active: true };\n\n this.play();\n }\n\n progress({ x, y, v, active }: Progress) {\n this.currentProgress = { x, y, v, active };\n if (typeof this.options.customEffect === 'function') {\n this.options.customEffect(this.target, this.currentProgress);\n }\n }\n\n cancel() {\n this.currentProgress = { x: 0.5, y: 0.5, v: { x: 0, y: 0 } };\n }\n\n getProgress() {\n return this.currentProgress;\n }\n\n play() {\n if (this.options.transition && this.target) {\n this.target.style.transition = this.options.transition;\n }\n }\n}\n\nexport function create(options: ScrubAnimationOptions & AnimationExtraOptions) {\n return (target: HTMLElement) => new CustomMouse(target, options);\n}\n"],"mappings":";AAMA,OAAO,MAAMA,WAAW,CAAC;EAKvBC,WAAWA,CAACC,MAAmB,EAAEC,OAA6B,EAAE;IAAAC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAC9D,IAAI,CAACF,MAAM,GAAGA,MAAM;IACpB,IAAI,CAACC,OAAO,GAAGA,OAAO,IAAI,CAAC,CAAC;IAC5B,IAAI,CAACE,eAAe,GAAG;MAAEC,CA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
|
3
|
+
*
|
|
4
|
+
* A wrapper object for Animation that mimics the same interface but implements CustomEffect that runs JS code instead of KeyframeEffect.
|
|
5
|
+
* The class is implemented by holding an inner Animation object instead of inheritance due to some browsers not allowing extension of built-in objects.
|
|
6
|
+
*/
|
|
7
|
+
export declare class CustomAnimation {
|
|
8
|
+
_animation: Animation;
|
|
9
|
+
customEffect: (progress: number | null) => void;
|
|
10
|
+
progress: number | null;
|
|
11
|
+
_tickCbId: number | null;
|
|
12
|
+
_finishHandler: (_: any) => void;
|
|
13
|
+
constructor(customEffect: (element: Element | null, progress: number | null) => void, target: Element | null, effectOptions: KeyframeEffectOptions, timingOptions: {
|
|
14
|
+
timeline?: AnimationTimeline | null;
|
|
15
|
+
});
|
|
16
|
+
private _tick;
|
|
17
|
+
get currentTime(): CSSNumberish | null;
|
|
18
|
+
set currentTime(time: CSSNumberish | null);
|
|
19
|
+
get startTime(): CSSNumberish | null;
|
|
20
|
+
set startTime(time: CSSNumberish | null);
|
|
21
|
+
get playbackRate(): number;
|
|
22
|
+
set playbackRate(speed: number);
|
|
23
|
+
get id(): string;
|
|
24
|
+
set id(uid: string);
|
|
25
|
+
get effect(): AnimationEffect | null;
|
|
26
|
+
set effect(e: AnimationEffect | null);
|
|
27
|
+
get timeline(): AnimationTimeline | null;
|
|
28
|
+
set timeline(tl: AnimationTimeline | null);
|
|
29
|
+
get finished(): Promise<Animation>;
|
|
30
|
+
get pending(): boolean;
|
|
31
|
+
get playState(): AnimationPlayState;
|
|
32
|
+
get ready(): Promise<Animation>;
|
|
33
|
+
get replaceState(): AnimationReplaceState;
|
|
34
|
+
get oncancel(): ((this: Animation, ev: AnimationPlaybackEvent) => any) | null;
|
|
35
|
+
set oncancel(cb: ((this: Animation, ev: AnimationPlaybackEvent) => any) | null);
|
|
36
|
+
get onfinish(): ((this: Animation, ev: AnimationPlaybackEvent) => any) | null;
|
|
37
|
+
set onfinish(cb: ((this: Animation, ev: AnimationPlaybackEvent) => any) | null);
|
|
38
|
+
get onremove(): ((this: Animation, ev: Event) => any) | null;
|
|
39
|
+
set onremove(cb: ((this: Animation, ev: Event) => any) | null);
|
|
40
|
+
play(): void;
|
|
41
|
+
pause(): void;
|
|
42
|
+
cancel(): void;
|
|
43
|
+
commitStyles(): void;
|
|
44
|
+
finish(): void;
|
|
45
|
+
persist(): void;
|
|
46
|
+
reverse(): void;
|
|
47
|
+
updatePlaybackRate(playbackRate: number): void;
|
|
48
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
49
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
50
|
+
dispatchEvent(event: Event): boolean;
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=CustomAnimation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CustomAnimation.d.ts","sourceRoot":"","sources":["../../src/CustomAnimation.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,qBAAa,eAAe;IAC1B,UAAU,EAAE,SAAS,CAAC;IACtB,YAAY,EAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAChD,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,cAAc,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;gBAG/B,YAAY,EAAE,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,EACxE,MAAM,EAAE,OAAO,GAAG,IAAI,EACtB,aAAa,EAAE,qBAAqB,EACpC,aAAa,EAAE;QAAE,QAAQ,CAAC,EAAE,iBAAiB,GAAG,IAAI,CAAA;KAAE;IA8BxD,OAAO,CAAC,KAAK;IAqBb,IAAI,WAAW,IAGO,YAAY,GAAG,IAAI,CADxC;IACD,IAAI,W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KAAK,KAAK,GAAG,CAAC,GAAG,IAAI,CAD5D;IACD,IAAI,QAAQ,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,KAAK,KAAK,GAAG,CAAC,GAAG,IAAI,EAE5D;IAGD,IAAI;IAMJ,KAAK;IAML,MAAM;IAUN,YAAY;IAOZ,MAAM;IAGN,OAAO;IAGP,OAAO;IAGP,kBAAkB,CAAC,YAAY,EAAE,MAAM;IAKvC,gBAAgB,CACd,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,kCAAkC,EAC5C,OAAO,CAAC,EAAE,OAAO,GAAG,uBAAuB;IAI7C,mBAAmB,CACjB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,kCAAkC,EAC5C,OAAO,CAAC,EAAE,OAAO,GAAG,uBAAuB;IAI7C,aAAa,CAAC,KAAK,EAAE,KAAK;CAG3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webAnimations.d.ts","sourceRoot":"","sources":["../../../src/api/webAnimations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAIV,gBAAgB,EAEhB,sBAAsB,EAEtB,cAAc,EAEf,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"webAnimations.d.ts","sourceRoot":"","sources":["../../../src/api/webAnimations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAIV,gBAAgB,EAEhB,sBAAsB,EAEtB,cAAc,EAEf,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AA4CnD,iBAAS,eAAe,CACtB,MAAM,EAAE,WAAW,GAAG,MAAM,GAAG,IAAI,EACnC,gBAAgB,EAAE,gBAAgB,EAClC,OAAO,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,GAAG;IAAE,OAAO,CAAC,EAAE,WAAW,CAAA;CAAE,EAC7D,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC7B,aAAa,CAAC,EAAE,QAAQ,GACvB,cAAc,GAAG,sBAAsB,CAgJzC;AAED,OAAO,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomMouse.d.ts","sourceRoot":"","sources":["../../../../src/library/mouse/CustomMouse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,QAAQ,EACR,qBAAqB,EACtB,MAAM,aAAa,CAAC;AAErB,qBAAa,WAAW;IACtB,MAAM,EAAE,WAAW,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC7B,eAAe,EAAE,QAAQ,CAAC;gBAEd,MAAM,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAQ9D,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,QAAQ;
|
|
1
|
+
{"version":3,"file":"CustomMouse.d.ts","sourceRoot":"","sources":["../../../../src/library/mouse/CustomMouse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,QAAQ,EACR,qBAAqB,EACtB,MAAM,aAAa,CAAC;AAErB,qBAAa,WAAW;IACtB,MAAM,EAAE,WAAW,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC7B,eAAe,EAAE,QAAQ,CAAC;gBAEd,MAAM,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAQ9D,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,QAAQ;IAOtC,MAAM;IAIN,WAAW;IAIX,IAAI;CAKL;AAED,wBAAgB,MAAM,CAAC,OAAO,EAAE,qBAAqB,GAAG,qBAAqB,YAC3D,WAAW,iBAC5B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/motion",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.628.0",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "wow!Team",
|
|
@@ -83,5 +83,5 @@
|
|
|
83
83
|
"wallaby": {
|
|
84
84
|
"autoDetect": true
|
|
85
85
|
},
|
|
86
|
-
"falconPackageHash": "
|
|
86
|
+
"falconPackageHash": "8650937207b6a6b03bb80f0a6e561791d9b6c491ecfbad6c6fbefe57"
|
|
87
87
|
}
|