fancoolo-fx 1.1.0 → 1.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fancoolo-fx",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "A class-driven GSAP animation wrapper for WordPress and static sites.",
5
5
  "main": "src/fx.js",
6
6
  "keywords": ["gsap", "animation", "scrolltrigger", "splittext", "wordpress", "gutenberg"],
package/src/fx.js CHANGED
@@ -84,10 +84,11 @@
84
84
  spinReveal: { duration: 1.4, ease: 'power3.out' },
85
85
  bgReveal: { duration: 1, ease: 'power3.out' },
86
86
  scaleIn: { duration: 1, ease: 'power3.out' },
87
- fadeIn: { duration: 0.8, ease: 'power2.out' },
87
+ fadeIn: { duration: 1.4, ease: 'power1.out' },
88
88
  blurIn: { duration: 1.2, ease: 'power2.out' },
89
89
  clipUp: { duration: 1, ease: 'power3.inOut' },
90
90
  clipDown: { duration: 1, ease: 'power3.inOut' },
91
+ tiltIn: { duration: 1.4, ease: 'power3.out' },
91
92
  };
92
93
 
93
94
  // ── Helpers ──────────────────────────────────
@@ -251,6 +252,7 @@
251
252
 
252
253
  var tweenVars = {
253
254
  opacity: 0,
255
+ scale: opts.scale != null ? opts.scale : 0.95,
254
256
  duration: o.duration,
255
257
  ease: o.ease,
256
258
  delay: o.delay,
@@ -318,6 +320,31 @@
318
320
  gsap.from(el, tweenVars);
319
321
  }
320
322
 
323
+ function tiltIn(el, opts) {
324
+ opts = opts || {};
325
+ var o = resolveOptions(el, 'tiltIn', opts);
326
+
327
+ gsap.fromTo(el, {
328
+ rotationX: opts.rotationX != null ? opts.rotationX : 45,
329
+ scale: opts.scale != null ? opts.scale : 0.8,
330
+ opacity: opts.opacity != null ? opts.opacity : 0,
331
+ transformPerspective: opts.perspective != null ? opts.perspective : 1000,
332
+ transformOrigin: opts.transformOrigin || 'center bottom',
333
+ }, {
334
+ rotationX: 0,
335
+ scale: 1,
336
+ opacity: 1,
337
+ transformPerspective: 1000,
338
+ ease: o.ease,
339
+ scrollTrigger: {
340
+ trigger: (opts.scrollTrigger && opts.scrollTrigger.trigger) || el,
341
+ start: config.scrollStart || 'top 85%',
342
+ end: opts.end || 'top 20%',
343
+ scrub: opts.scrub != null ? opts.scrub : 0.6,
344
+ },
345
+ });
346
+ }
347
+
321
348
  // ── Class-to-effect mapping ─────────────────
322
349
 
323
350
  var effects = {
@@ -342,6 +369,7 @@
342
369
  blurIn: blurIn,
343
370
  clipUp: clipUp,
344
371
  clipDown: clipDown,
372
+ tiltIn: tiltIn,
345
373
  };
346
374
 
347
375
  // ── Helpers ──────────────────────────────────
@@ -429,7 +457,16 @@
429
457
  }
430
458
  });
431
459
 
432
- // 4. Tag-based auto-animation inside sections
460
+ // 4. fx-tilt-in — scrub-based 3D perspective (always scroll-linked)
461
+ // Processed before tagMap so tilt elements aren't grabbed by tagMap first.
462
+ document.querySelectorAll('.fx-tilt-in-st, .fx-tilt-in-pl, .fx-tilt-in').forEach(function (el) {
463
+ if (!processed.has(el)) {
464
+ tiltIn(el);
465
+ processed.add(el);
466
+ }
467
+ });
468
+
469
+ // 5. Tag-based auto-animation inside sections
433
470
  if (config.tagMap && config.sectionSelector) {
434
471
  document.querySelectorAll(config.sectionSelector).forEach(function (section) {
435
472
  Object.keys(config.tagMap).forEach(function (selector) {
@@ -492,6 +529,7 @@
492
529
  processed.add(child);
493
530
  });
494
531
  });
532
+
495
533
  }
496
534
 
497
535
  // ── Boot ────────────────────────────────────
@@ -529,6 +567,7 @@
529
567
  blurIn: blurIn,
530
568
  clipUp: clipUp,
531
569
  clipDown: clipDown,
570
+ tiltIn: tiltIn,
532
571
  init: init,
533
572
  };
534
573
  })();
@@ -84,10 +84,11 @@
84
84
  spinReveal: { duration: 1.4, ease: 'power3.out' },
85
85
  bgReveal: { duration: 1, ease: 'power3.out' },
86
86
  scaleIn: { duration: 1, ease: 'power3.out' },
87
- fadeIn: { duration: 0.8, ease: 'power2.out' },
87
+ fadeIn: { duration: 1.4, ease: 'power1.out' },
88
88
  blurIn: { duration: 1.2, ease: 'power2.out' },
89
89
  clipUp: { duration: 1, ease: 'power3.inOut' },
90
90
  clipDown: { duration: 1, ease: 'power3.inOut' },
91
+ tiltIn: { duration: 1.4, ease: 'power3.out' },
91
92
  };
92
93
 
93
94
  // ── Helpers ──────────────────────────────────
@@ -251,6 +252,7 @@
251
252
 
252
253
  var tweenVars = {
253
254
  opacity: 0,
255
+ scale: opts.scale != null ? opts.scale : 0.95,
254
256
  duration: o.duration,
255
257
  ease: o.ease,
256
258
  delay: o.delay,
@@ -318,6 +320,31 @@
318
320
  gsap.from(el, tweenVars);
319
321
  }
320
322
 
323
+ function tiltIn(el, opts) {
324
+ opts = opts || {};
325
+ var o = resolveOptions(el, 'tiltIn', opts);
326
+
327
+ gsap.fromTo(el, {
328
+ rotationX: opts.rotationX != null ? opts.rotationX : 45,
329
+ scale: opts.scale != null ? opts.scale : 0.8,
330
+ opacity: opts.opacity != null ? opts.opacity : 0,
331
+ transformPerspective: opts.perspective != null ? opts.perspective : 1000,
332
+ transformOrigin: opts.transformOrigin || 'center bottom',
333
+ }, {
334
+ rotationX: 0,
335
+ scale: 1,
336
+ opacity: 1,
337
+ transformPerspective: 1000,
338
+ ease: o.ease,
339
+ scrollTrigger: {
340
+ trigger: (opts.scrollTrigger && opts.scrollTrigger.trigger) || el,
341
+ start: config.scrollStart || 'top 85%',
342
+ end: opts.end || 'top 20%',
343
+ scrub: opts.scrub != null ? opts.scrub : 0.6,
344
+ },
345
+ });
346
+ }
347
+
321
348
  // ── Class-to-effect mapping ─────────────────
322
349
 
323
350
  var effects = {
@@ -342,6 +369,7 @@
342
369
  blurIn: blurIn,
343
370
  clipUp: clipUp,
344
371
  clipDown: clipDown,
372
+ tiltIn: tiltIn,
345
373
  };
346
374
 
347
375
  // ── Helpers ──────────────────────────────────
@@ -429,7 +457,16 @@
429
457
  }
430
458
  });
431
459
 
432
- // 4. Tag-based auto-animation inside sections
460
+ // 4. fx-tilt-in — scrub-based 3D perspective (always scroll-linked)
461
+ // Processed before tagMap so tilt elements aren't grabbed by tagMap first.
462
+ document.querySelectorAll('.fx-tilt-in-st, .fx-tilt-in-pl, .fx-tilt-in').forEach(function (el) {
463
+ if (!processed.has(el)) {
464
+ tiltIn(el);
465
+ processed.add(el);
466
+ }
467
+ });
468
+
469
+ // 5. Tag-based auto-animation inside sections
433
470
  if (config.tagMap && config.sectionSelector) {
434
471
  document.querySelectorAll(config.sectionSelector).forEach(function (section) {
435
472
  Object.keys(config.tagMap).forEach(function (selector) {
@@ -492,6 +529,7 @@
492
529
  processed.add(child);
493
530
  });
494
531
  });
532
+
495
533
  }
496
534
 
497
535
  // ── Boot ────────────────────────────────────
@@ -529,6 +567,7 @@
529
567
  blurIn: blurIn,
530
568
  clipUp: clipUp,
531
569
  clipDown: clipDown,
570
+ tiltIn: tiltIn,
532
571
  init: init,
533
572
  };
534
573
  })();
@@ -3,7 +3,7 @@
3
3
  * Plugin Name: Fancoolo FX
4
4
  * Plugin URI: https://github.com/krstivoja/fancoolo-fx
5
5
  * Description: A class-driven GSAP animation wrapper. Add CSS classes in Gutenberg and get animations — no JavaScript needed.
6
- * Version: 1.1.0
6
+ * Version: 1.2.0
7
7
  * Author: Fancoolo
8
8
  * Author URI: https://github.com/krstivoja
9
9
  * License: ISC
@@ -14,7 +14,7 @@ if ( ! defined( 'ABSPATH' ) ) {
14
14
  exit;
15
15
  }
16
16
 
17
- define( 'FANCOOLO_FX_VERSION', '1.1.0' );
17
+ define( 'FANCOOLO_FX_VERSION', '1.2.0' );
18
18
  define( 'FANCOOLO_FX_PATH', plugin_dir_path( __FILE__ ) );
19
19
  define( 'FANCOOLO_FX_URL', plugin_dir_url( __FILE__ ) );
20
20
 
@@ -253,6 +253,11 @@ function fancoolo_fx_render_admin_page() {
253
253
  <tr><td><code>FX.spinReveal(el, opts)</code></td><td>Rotate and scale in</td></tr>
254
254
  <tr><td><code>FX.bgReveal(el, opts)</code></td><td>Background slide up</td></tr>
255
255
  <tr><td><code>FX.scaleIn(el, opts)</code></td><td>Scale up with fade</td></tr>
256
+ <tr><td><code>FX.fadeIn(el, opts)</code></td><td>Opacity + subtle scale, no movement</td></tr>
257
+ <tr><td><code>FX.blurIn(el, opts)</code></td><td>Fade in while deblurring</td></tr>
258
+ <tr><td><code>FX.clipUp(el, opts)</code></td><td>Clip-path wipe from bottom</td></tr>
259
+ <tr><td><code>FX.clipDown(el, opts)</code></td><td>Clip-path wipe from top</td></tr>
260
+ <tr><td><code>FX.tiltIn(el, opts)</code></td><td>3D perspective reveal (scrub-based)</td></tr>
256
261
  <tr><td><code>FX.init()</code></td><td>Re-scan DOM — call after changing any config</td></tr>
257
262
  </tbody>
258
263
  </table>
@@ -367,6 +372,11 @@ FX.init();</pre>
367
372
  <div class="ffx-class-row"><code data-copy>fx-clip-down-st</code><span class="ffx-desc">Scroll triggered</span></div>
368
373
  <div class="ffx-class-row"><code data-copy>fx-clip-down</code><span class="ffx-desc">Auto triggered inside a section</span></div>
369
374
 
375
+ <!-- Tilt In -->
376
+ <div class="ffx-group-title">Tilt In <span style="font-weight:normal;color:#646970;font-size:12px;">(scrub — tied to scroll position)</span></div>
377
+ <div class="ffx-class-row"><code data-copy>fx-tilt-in-st</code><span class="ffx-desc">3D perspective reveal linked to scroll</span></div>
378
+ <div class="ffx-class-row"><code data-copy>fx-tilt-in</code><span class="ffx-desc">Auto triggered inside a section</span></div>
379
+
370
380
  <!-- Stagger All -->
371
381
  <div class="ffx-group-title" style="margin-top: 20px;">Stagger Children <span style="font-weight:normal;color:#646970;font-size:12px;">(pair with an effect class)</span></div>
372
382
  <div class="ffx-class-row"><code data-copy>fx-stagger-all-[img]</code><span class="ffx-desc">Target all img children — requires effect class</span></div>