@splash-tech/jackpot-sdk 3.0.1 → 3.0.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.
@@ -48,6 +48,7 @@ export class DefaultClientWinWidget extends WinWidgetBase {
48
48
  targetContainer.style.position = 'relative';
49
49
  }
50
50
  }
51
+ // container
51
52
  const container = document.createElement('div');
52
53
  container.dataset.winWidget = 'container';
53
54
  Object.assign(container.style, {
@@ -57,11 +58,38 @@ export class DefaultClientWinWidget extends WinWidgetBase {
57
58
  height: '100%',
58
59
  overflow: 'hidden',
59
60
  zIndex: '99999999', // 8
60
- clipPath: 'circle(0% at 50% 50%)',
61
- transition: 'clip-path 1.2s cubic-bezier(0.22, 1, 0.36, 1)',
62
61
  });
63
- targetContainer.appendChild(container);
64
- container.appendChild(iframe);
62
+ // circle
63
+ const circle = document.createElement('div');
64
+ circle.dataset.winWidget = 'circle';
65
+ Object.assign(circle.style, {
66
+ position: 'absolute',
67
+ left: '50%',
68
+ top: '50%',
69
+ width: '0px',
70
+ height: '0px',
71
+ borderRadius: '50%',
72
+ overflow: 'hidden',
73
+ transform: 'translate(-50%, -50%)',
74
+ transition: 'width 1.2s cubic-bezier(0.22, 1, 0.36, 1), height 1.2s cubic-bezier(0.22, 1, 0.36, 1)',
75
+ });
76
+ // iframe
77
+ const viewportW = `${window.innerWidth}px`;
78
+ const viewportH = `${window.innerHeight}px`;
79
+ Object.assign(iframe.style, {
80
+ position: 'absolute',
81
+ left: '50%',
82
+ top: '50%',
83
+ width: viewportW,
84
+ height: viewportH,
85
+ transform: 'translate(-50%, -50%)',
86
+ border: 'none',
87
+ backgroundColor: 'rgba(0, 0, 0, 0.5)',
88
+ });
89
+ // append iframe into the circle, then circle into the container
90
+ circle.appendChild(iframe);
91
+ container.appendChild(circle);
92
+ // blur overlay
65
93
  const overlay = document.createElement('div');
66
94
  overlay.dataset.winWidget = 'overlay';
67
95
  Object.assign(overlay.style, {
@@ -74,14 +102,23 @@ export class DefaultClientWinWidget extends WinWidgetBase {
74
102
  backdropFilter: 'blur(0px)',
75
103
  transition: 'background 0.8s ease, backdrop-filter 0.8s ease',
76
104
  });
105
+ // append overlay and container into the targetContainer
77
106
  targetContainer.appendChild(overlay);
107
+ targetContainer.appendChild(container);
108
+ // blur animation
78
109
  setTimeout(() => {
79
110
  overlay.style.background = 'rgba(0,0,0,0.4)';
80
111
  overlay.style.backdropFilter = 'blur(8px)';
81
112
  }, 200);
82
- setTimeout(() => {
83
- container.style.clipPath = 'circle(150% at 50% 50%)';
84
- }, 1000);
113
+ // circle grow animation
114
+ requestAnimationFrame(() => {
115
+ setTimeout(() => {
116
+ const size = Math.ceil(Math.sqrt(window.innerWidth * window.innerWidth +
117
+ window.innerHeight * window.innerHeight) * 2);
118
+ circle.style.width = `${size}px`;
119
+ circle.style.height = `${size}px`;
120
+ }, 1000);
121
+ });
85
122
  this.setLaunched(true);
86
123
  }
87
124
  cleanupLaunchAnimation() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@splash-tech/jackpot-sdk",
3
- "version": "3.0.1",
3
+ "version": "3.0.2",
4
4
  "description": "SDK for managing jackpot widgets in iframes",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",