@spiffcommerce/preview 3.6.2-rc.8 → 4.0.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.
Files changed (45) hide show
  1. package/dist/index.esm.js +1576 -38
  2. package/dist/index.umd.js +1 -0
  3. package/package.json +4 -6
  4. package/dist/_tslib.esm.js +0 -33
  5. package/dist/animation.esm.js +0 -1364
  6. package/dist/assetCache.esm.js +0 -6
  7. package/dist/assetCache.esm2.js +0 -825
  8. package/dist/blurPostProcess.esm.js +0 -327
  9. package/dist/bumpVertex.esm.js +0 -497
  10. package/dist/compatibilityOptions.esm.js +0 -68
  11. package/dist/configuration.esm.js +0 -121
  12. package/dist/core.esm.js +0 -8135
  13. package/dist/dynamicTexture.esm.js +0 -105
  14. package/dist/dynamicTexture.esm2.js +0 -238
  15. package/dist/easing.esm.js +0 -130
  16. package/dist/effectFallbacks.esm.js +0 -378
  17. package/dist/engine.esm.js +0 -25504
  18. package/dist/glbLoaderExtensions.esm.js +0 -690
  19. package/dist/glowLayer.esm.js +0 -1621
  20. package/dist/glowLayerManager.esm.js +0 -50
  21. package/dist/guid.esm.js +0 -21
  22. package/dist/hdrFilteringFunctions.esm.js +0 -816
  23. package/dist/helperFunctions.esm.js +0 -5145
  24. package/dist/material.esm.js +0 -115
  25. package/dist/material.esm2.js +0 -5245
  26. package/dist/math.axis.esm.js +0 -35
  27. package/dist/math.color.esm.js +0 -1661
  28. package/dist/math.path.esm.js +0 -15
  29. package/dist/math.size.esm.js +0 -137
  30. package/dist/mesh.esm.js +0 -11170
  31. package/dist/modelContainer.esm.js +0 -1895
  32. package/dist/node.esm.js +0 -795
  33. package/dist/pbrBRDFFunctions.esm.js +0 -124
  34. package/dist/pbrMaterial.esm.js +8 -8739
  35. package/dist/productAnimations.esm.js +0 -182
  36. package/dist/productCamera.esm.js +0 -14
  37. package/dist/productCamera.esm2.js +0 -3870
  38. package/dist/renderConstants.esm.js +0 -116
  39. package/dist/renderingPipeline.esm.js +0 -18
  40. package/dist/renderingPipeline.esm2.js +1 -3594
  41. package/dist/sceneLoaderFlags.esm.js +0 -51
  42. package/dist/types.esm.js +0 -30
  43. package/dist/variants.esm.js +0 -16
  44. package/dist/variants.esm2.js +0 -3097
  45. package/dist/webRequest.esm.js +0 -7777
@@ -1,182 +0,0 @@
1
- import { A as Animation } from './animation.esm.js';
2
- import { E as EasingFunction, Q as QuadraticEase } from './easing.esm.js';
3
- import { V as Vector3 } from './webRequest.esm.js';
4
- import './math.color.esm.js';
5
- import './node.esm.js';
6
- import './math.size.esm.js';
7
- import './math.path.esm.js';
8
-
9
- const CAMERA_FRAME_RATE = 60;
10
- const SPEED_RATIO = 1;
11
- function getAvgFrameRateForAnimGroup(animGroup) {
12
- const sum = animGroup.targetedAnimations
13
- .map((ta) => ta.animation.framePerSecond)
14
- .reduce((a, b) => a + b, 0);
15
- return sum / animGroup.targetedAnimations.length || 0;
16
- }
17
- /**
18
- * Executes a set of animations. Typically for a single model.
19
- * @param animGroups The animation groups to execute.
20
- * @param loop Whether or not to loop the animations.
21
- * @param to The frame to animate to.
22
- * @param from The frame to animate from.
23
- * @param name The name of the animation to execute. If not provided all animations will be executed.
24
- */
25
- function executeAnimationGroups(animGroups, loop, to, from, name) {
26
- const targetAnimations = !name
27
- ? animGroups
28
- : animGroups.filter((ag) => ag.name === name);
29
- if (targetAnimations.length === 0) {
30
- console.warn(`No animations found for name: ${name}`);
31
- return;
32
- }
33
- // When our to & from values match we want to go immediately
34
- // to a specific sequence of the animation.
35
- if (from !== undefined && to !== undefined && from === to) {
36
- targetAnimations.forEach((animGroup) => {
37
- animGroup.stop();
38
- const frameRate = getAvgFrameRateForAnimGroup(animGroup);
39
- const targetFrame = from * frameRate;
40
- animGroup.start(loop, SPEED_RATIO, targetFrame, targetFrame);
41
- });
42
- return;
43
- }
44
- // Otherwise we go to the 'from' value and play through to the 'to'
45
- // value, looping if requested.
46
- targetAnimations.forEach((animGroup) => {
47
- animGroup.stop();
48
- const frameRate = getAvgFrameRateForAnimGroup(animGroup);
49
- const fromFrame = from !== undefined ? from * frameRate : undefined;
50
- const toFrame = to !== undefined ? to * frameRate : undefined;
51
- animGroup.start(loop, SPEED_RATIO, fromFrame, toFrame);
52
- });
53
- }
54
- /**
55
- * Stops all animations for a given collection of animation groups. This typically comes from a single model.
56
- * @param animGroups The animation groups to stop.
57
- */
58
- function resetAnimationGroups(animGroups) {
59
- animGroups.forEach((animGroup) => {
60
- animGroup.stop();
61
- });
62
- }
63
- /**
64
- * Executes all animations in a scene.
65
- * @param scene The scene to execute animations in.
66
- * @param loop Whether or not to loop the animations.
67
- * @param to The frame to animate to.
68
- * @param from The frame to animate from.
69
- */
70
- function executeAllAnimationsInScene(scene, loop, to, from) {
71
- const animGroups = scene.animationGroups;
72
- executeAnimationGroups(animGroups, loop, to, from);
73
- }
74
- /**
75
- * Stops all animations in a scene.
76
- * @param scene The scene to stop animations on.
77
- */
78
- function resetSceneModelAnimations(scene) {
79
- const animGroups = scene.animationGroups;
80
- resetAnimationGroups(animGroups);
81
- }
82
- /**
83
- * Stops the camera from animating.
84
- * @param camera The camera to stop animating
85
- */
86
- function resetCameraAnimation(camera) {
87
- camera.getScene().stopAnimation(camera);
88
- camera.animations = [];
89
- }
90
- /**
91
- * Animates the camera based on configuration.
92
- * @param scene The scene the camera relates to.
93
- * @param camera The camera to e animated
94
- * @param cameraAnimation The animation configuration to play.
95
- */
96
- function animateCameraInScene(scene, camera, cameraAnimation) {
97
- // Clear any existing animation, not doing so will hang this animation.
98
- scene.stopAnimation(camera);
99
- camera.animations = [];
100
- // We set the alpha to the equivalent location of its current value but with a value 0 - PI * 2
101
- if (Math.abs(camera.alpha) > 2 * Math.PI) {
102
- camera.alpha = wrap2Range(camera.alpha, 0, 2 * Math.PI);
103
- }
104
- const animSet = [];
105
- // Indices for ordering the animation operations, we want to rotate before
106
- // we pan.
107
- const hasTargetTween = cameraAnimation.target;
108
- const panSequenceIndex = 0;
109
- const rotationSequenceIndex = hasTargetTween ? 1 : 0;
110
- const targetHasComponents = cameraAnimation.target && Object.keys(cameraAnimation.target).length > 0;
111
- // Build target animation
112
- if (targetHasComponents) {
113
- animSet.push(createAnimation('cameraTargetLerp', 'target', new Vector3().copyFrom(camera.target), new Vector3(cameraAnimation.target.x, cameraAnimation.target.y, cameraAnimation.target.z), Animation.ANIMATIONTYPE_VECTOR3, panSequenceIndex));
114
- }
115
- // Build the alpha & beta animations
116
- animSet.push(createAnimation('cameraAlphaLerp', 'alpha', camera.alpha, degToRad(cameraAnimation.lonDeg), Animation.ANIMATIONTYPE_FLOAT, rotationSequenceIndex));
117
- animSet.push(createAnimation('cameraBetaLerp', 'beta', camera.beta, degToRad(cameraAnimation.latDeg), Animation.ANIMATIONTYPE_FLOAT, rotationSequenceIndex));
118
- // Build the radius animation
119
- if (cameraAnimation.radius !== undefined) {
120
- const targetRadius = Math.max(0.01, cameraAnimation.radius);
121
- animSet.push(createAnimation('cameraRadiusLerp', 'radius', camera.radius, targetRadius, Animation.ANIMATIONTYPE_FLOAT, rotationSequenceIndex));
122
- }
123
- // Execute the animations, cleaning up after it completes.
124
- camera.animations.push(...animSet);
125
- // When we run a camera animation we must disable any existing
126
- // auto rotation too prevent any animations conflicting with each other.
127
- // If it was enabled we re-enable again when the animation has finished running.
128
- const rotationWasActive = camera.useAutoRotationBehavior;
129
- camera.disableAutoRotationBehavior();
130
- // Finally, execute the animation on the scene.
131
- scene.beginAnimation(camera, 0, hasTargetTween ? CAMERA_FRAME_RATE * 2 : CAMERA_FRAME_RATE, false, 1, () => {
132
- camera.animations = [];
133
- if (rotationWasActive) {
134
- camera.enableAutoRotationBehavior();
135
- }
136
- });
137
- }
138
- /**
139
- * Small helper for converting Degrees to Radians
140
- * @param value The value to convert
141
- */
142
- function degToRad(value) {
143
- return (value * Math.PI) / 180;
144
- }
145
- /**
146
- * A generic function for tweens between two values which is a concept used
147
- * heavily in our camera animation system.
148
- * @param animName The name of the animation.
149
- * @param targetProperty A target property to affect on the object holding the animation.
150
- * @param fromValue The initial value of the property.
151
- * @param toValue The end value of the property.
152
- * @param dataType The data type being modified eg. Animation.ANIMATIONTYPE_VECTOR3
153
- * @param ordering animations are sequenced via ordering, an ordering of 0 means the animation will play from frame 0 -> FRAME_RATE
154
- * an ordering of 1 means the animation will play from FRAME_RATE -> FRAME_RATE * 2 allowing us to play animations in a specific order.
155
- * @param loopmode What to do when the animation completes eg. Animation.ANIMATIONLOOPMODE_CYCLE
156
- */
157
- function createAnimation(animName, targetProperty, fromValue, toValue, dataType, ordering = 0, loopmode = Animation.ANIMATIONLOOPMODE_CONSTANT) {
158
- const easingFunc = new QuadraticEase();
159
- easingFunc.setEasingMode(EasingFunction.EASINGMODE_EASEINOUT);
160
- const targetAnim = new Animation(animName, targetProperty, CAMERA_FRAME_RATE, dataType, loopmode);
161
- const targetKeys = [];
162
- ordering > 0 && targetKeys.push({ frame: 0, value: fromValue });
163
- targetKeys.push({ frame: CAMERA_FRAME_RATE * ordering, value: fromValue });
164
- targetKeys.push({
165
- frame: CAMERA_FRAME_RATE * (ordering + 1),
166
- value: toValue,
167
- });
168
- targetAnim.setKeys(targetKeys);
169
- targetAnim.setEasingFunction(easingFunc);
170
- return targetAnim;
171
- }
172
- // Given min, max. Return a value that wraps from max to min or vice versa if required.
173
- function wrap2Range(val, min, max) {
174
- if (val < min) {
175
- return (val = max - ((min - val) % (max - min)));
176
- }
177
- else {
178
- return (val = min + ((val - min) % (max - min)));
179
- }
180
- }
181
-
182
- export { animateCameraInScene, executeAllAnimationsInScene, executeAnimationGroups, resetAnimationGroups, resetCameraAnimation, resetSceneModelAnimations };
@@ -1,14 +0,0 @@
1
- export { P as ProductCamera } from './productCamera.esm2.js';
2
- import './webRequest.esm.js';
3
- import './node.esm.js';
4
- import './mesh.esm.js';
5
- import './engine.esm.js';
6
- import './math.color.esm.js';
7
- import './material.esm2.js';
8
- import './compatibilityOptions.esm.js';
9
- import './sceneLoaderFlags.esm.js';
10
- import './math.axis.esm.js';
11
- import './easing.esm.js';
12
- import './math.path.esm.js';
13
- import './animation.esm.js';
14
- import './math.size.esm.js';