aw-front-helpers 2.5.25 → 2.5.27

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.
@@ -0,0 +1,76 @@
1
+ import { gsap } from "gsap";
2
+ import { SplitText } from "gsap/SplitText";
3
+
4
+ export default class Credits {
5
+ constructor() {
6
+ gsap.registerPlugin(SplitText);
7
+ this._pattern = [
8
+ '\u0041\u0072\u0072\u006f\u0077\u0055\u0070',
9
+ '\u0041\u0072\u0072\u006f\u0077\u0055\u0070',
10
+ '\u0041\u0072\u0072\u006f\u0077\u0044\u006f\u0077\u006e',
11
+ '\u0041\u0072\u0072\u006f\u0077\u0044\u006f\u0077\u006e',
12
+ '\u0041\u0072\u0072\u006f\u0077\u004c\u0065\u0066\u0074',
13
+ '\u0041\u0072\u0072\u006f\u0077\u0052\u0069\u0067\u0068\u0074',
14
+ '\u0041\u0072\u0072\u006f\u0077\u004c\u0065\u0066\u0074',
15
+ '\u0041\u0072\u0072\u006f\u0077\u0052\u0069\u0067\u0068\u0074',
16
+ '\u0062',
17
+ '\u0061'
18
+ ].reverse();
19
+ this._current = 0;
20
+ this._createBounds();
21
+ this._addEvents();
22
+ }
23
+
24
+ _onKeyDown(pEvt) {
25
+ if (this._pattern.indexOf(pEvt.key) < 0 || pEvt.key !== this._pattern[this._current]) {
26
+ this._current = 0;
27
+ return;
28
+ }
29
+ this._current++;
30
+ if (this._pattern.length === this._current) {
31
+ this._current = 0;
32
+ this._launch()
33
+ }
34
+ }
35
+
36
+ _createBounds() {
37
+ ['_onKeyDown'].forEach(
38
+ fn => (this[fn] = this[fn].bind(this))
39
+ );
40
+ }
41
+
42
+ _launch() {
43
+ const wrapper = document.createElement('div');
44
+ const text = document.createElement('p');
45
+ document.body.appendChild(wrapper);
46
+ wrapper.appendChild(text);
47
+ text.innerHTML = `\u0059\u006f\u0061\u006e\u006e\u0020\u004c\u0065\u0020\u0050\u002e\u0020\u0066\u006f\u0072\u0020\u0041\u0057\u0020\u0053\u0074\u0075\u0064\u0069\u006f\u003c\u0062\u0072\u003e\u003c\u0073\u006d\u0061\u006c\u006c\u003e\u0063\u0072\u0065\u0064\u0069\u0074\u0073\u0040\u0074\u006f\u0075\u0074\u0061\u0063\u006c\u0069\u0063\u002e\u0063\u006f\u006d\u003c\u002f\u0073\u006d\u0061\u006c\u006c\u003e`;
48
+ const split = SplitText.create(text, { type: "words, chars" });
49
+ gsap.set(text, {
50
+ fontSize: '20px'
51
+ });
52
+ gsap.set(wrapper, {
53
+ backgroundColor: '#001e2e',
54
+ position: 'fixed',
55
+ top: 0,
56
+ bottom: 0,
57
+ left: 0,
58
+ right: 0,
59
+ opacity: 0,
60
+ display: 'flex',
61
+ color: '#fff',
62
+ alignItems: 'center',
63
+ justifyContent: 'center',
64
+ textAlign: 'center',
65
+ lineHeight: 1.1,
66
+ zIndex: 100
67
+ });
68
+ gsap.to(wrapper, { duration: 1, opacity: 1});
69
+ gsap.from(split.chars, { delay: .6, duration: .3, x: 5, autoAlpha: 0, stagger: .07 });
70
+ wrapper.addEventListener('click', () => { wrapper.remove() }, { once: true });
71
+ }
72
+
73
+ _addEvents() {
74
+ window.addEventListener('keydown', this._onKeyDown);
75
+ }
76
+ }
package/index.js CHANGED
@@ -2,6 +2,7 @@ import GParallax from './classes/globalParallax'
2
2
  import Nearby from './classes/nearby'
3
3
  import FormControl from './classes/formControl'
4
4
  import Sticky from './classes/sticky'
5
+ import Credits from './classes/credits'
5
6
  import BootstraperMaps from './bootstraper/maps'
6
7
  import BootstraperYoutube from './bootstraper/youtube'
7
8
  import * as utils from './utils'
@@ -11,6 +12,7 @@ export {
11
12
  Nearby,
12
13
  FormControl,
13
14
  Sticky,
15
+ Credits,
14
16
  BootstraperMaps,
15
17
  BootstraperYoutube,
16
18
  utils
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aw-front-helpers",
3
- "version": "2.5.25",
3
+ "version": "2.5.27",
4
4
  "description": "Assets helpers for projects",
5
5
  "author": "Yoann Le Poupon",
6
6
  "license": "ISC",
@@ -14,6 +14,6 @@
14
14
  "es6-symbol": "^3.1.3",
15
15
  "exif-js": "^2.3.0",
16
16
  "debounce": "^1.2.1",
17
- "gsap": "^3.12.3"
17
+ "gsap": "^3.13.0"
18
18
  }
19
19
  }