@stellix-agency/motion 1.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.
@@ -0,0 +1,23 @@
1
+ interface MotionOptions extends gsap.TweenVars {
2
+ d?: number;
3
+ e?: string;
4
+ }
5
+ declare class MotionCore {
6
+ private tl;
7
+ private el;
8
+ private defaults;
9
+ constructor(el: HTMLElement);
10
+ private add;
11
+ in(options?: MotionOptions): this;
12
+ move(x: number, y: number, options?: MotionOptions): this;
13
+ scale(s: number, options?: MotionOptions): this;
14
+ wait(d: number): this;
15
+ /**
16
+ * Utilisation du type Vars de ScrollTrigger (le plus moderne)
17
+ */
18
+ onScroll(st?: ScrollTrigger.Vars): this;
19
+ }
20
+
21
+ declare function animate(el: HTMLElement, accessor: () => (m: MotionCore) => void): void;
22
+
23
+ export { MotionCore, type MotionOptions, animate };
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ import{gsap as p}from"gsap";import{ScrollTrigger as m}from"gsap/ScrollTrigger";import{gsap as n}from"gsap";import{ScrollTrigger as l}from"gsap/ScrollTrigger";var o=class{tl;el;defaults={d:.8,e:"power4.out"};constructor(t){this.el=t,n.set(this.el,{opacity:0,y:20}),this.tl=n.timeline({paused:!0}),Promise.resolve().then(()=>{this.tl.scrollTrigger||this.tl.play()})}add(t,e){let{d:r,e:s,...a}=e||{};return this.tl.to(this.el,{...t,duration:r??this.defaults.d,ease:s??this.defaults.e,...a},">"),this}in(t){return this.add({opacity:1,y:0},t)}move(t,e,r){return this.add({x:t,y:e},r)}scale(t,e){return this.add({scale:t,ease:e?.e??"back.out(1.7)"},e)}wait(t){return this.tl.to({},{duration:t},">"),this}onScroll(t){return l.create({trigger:this.el,start:"top 85%",animation:this.tl,toggleActions:"play none none reverse",...t}),this}};function h(i,t){let e=t(),r=new o(i);setTimeout(()=>{e(r)},0)}typeof window<"u"&&p.registerPlugin(m);export{o as MotionCore,h as animate};
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "@stellix-agency/motion",
3
+ "publishConfig": { "access": "public" },
4
+ "version": "1.0.0",
5
+ "description": "An intuitive GSAP wrapper for creating stunning animations with ease.",
6
+ "author": "Stellix Agency",
7
+ "license": "MIT",
8
+ "contributors": [
9
+ {
10
+ "name": "Yanis YOUSFI",
11
+ "email": "y.yousfi@stellix.agency"
12
+ }
13
+ ],
14
+ "type": "module",
15
+ "main": "./dist/index.js",
16
+ "module": "./dist/index.js",
17
+ "types": "./dist/index.d.ts",
18
+ "files": ["dist"],
19
+ "scripts": {
20
+ "build": "tsup src/index.ts --format esm --dts --clean",
21
+ "dev": "tsup src/index.ts --format esm --watch --dts"
22
+ },
23
+ "peerDependencies": {
24
+ "gsap": "^3.14.2",
25
+ "@astrojs/solid-js": "^5.1.3"
26
+ },
27
+ "devDependencies": {
28
+ "tsup": "^8.5.1",
29
+ "typescript": "^5.9.3",
30
+ "gsap": "^3.14.2",
31
+ "solid-js": "^1.9.11"
32
+ }
33
+ }