rytm-webflow 2.1.6 → 2.1.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rytm-webflow",
3
- "version": "2.1.6",
3
+ "version": "2.1.7",
4
4
  "description": "rytm webflow pack - ASwap, ShowUp",
5
5
  "main": "scripts/index.js",
6
6
  "scripts": {
@@ -214,6 +214,21 @@ class WebflowView extends View {
214
214
  });
215
215
  }
216
216
  });
217
+ // on scene add event
218
+ scene.on("add", (e) => {
219
+ // check if element is already in view
220
+ const rect = el.getBoundingClientRect();
221
+ if (rect.top >= 0 && rect.bottom <= window.innerHeight) {
222
+ // element is in view - animate IN
223
+ gsap.to(el, {
224
+ duration: propsShow.time,
225
+ ...propsShow.tween,
226
+ onComplete: () => {
227
+ el.classList.add(CLASS_NAME_WEBSCROLL_FIRED);
228
+ }
229
+ });
230
+ }
231
+ });
217
232
  scene.addTo(scrollController.get());
218
233
  this.scenes.push(scene);
219
234
  }