cheryglsljs 1.1.14 → 1.1.16

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # cheryglsljs
2
2
 
3
- A lightweight JavaScript library for beautiful, interactive image effects using Three.js, GLSL shaders, and GSAP. Easily add animated wave and transition effects to images in your web projects, with support for both CDN and bundler workflows.
3
+ A lightweight JavaScript library for beautiful, interactive image effects using Three.js, GLSL shaders, and GSAP. Easily add animated wave and transition effects to images in your web projects, with support for both CDN and npm/bundler workflows.
4
4
 
5
5
  ---
6
6
 
@@ -10,6 +10,15 @@ A lightweight JavaScript library for beautiful, interactive image effects using
10
10
  - Highly customizable via parameters (speed, strength, hover, etc.)
11
11
  - Works with both CDN and npm/bundler setups
12
12
  - Built on top of [Three.js](https://threejs.org/) and [GSAP](https://greensock.com/gsap/)
13
+ - Simple API for adding effects to your images
14
+
15
+ ---
16
+
17
+ ## 🏗️ What is it based on?
18
+
19
+ - **Three.js**: For 3D rendering and WebGL abstraction
20
+ - **GLSL**: For custom GPU-accelerated shader effects
21
+ - **GSAP**: For smooth, performant animations and transitions
13
22
 
14
23
  ---
15
24
 
@@ -19,8 +28,6 @@ A lightweight JavaScript library for beautiful, interactive image effects using
19
28
 
20
29
  1. Add Three.js and GSAP via CDN in your HTML:
21
30
  ```html
22
- <script src="https://cdn.jsdelivr.net/npm/three@0.154.0/build/three.min.js"></script>
23
- <script src="https://cdn.jsdelivr.net/npm/gsap@3.12.5/dist/gsap.min.js"></script>
24
31
  <script src="https://unpkg.com/cheryglsljs/dist/cherry.js"></script>
25
32
  ```
26
33
 
@@ -38,53 +45,128 @@ A lightweight JavaScript library for beautiful, interactive image effects using
38
45
  2. Import in your JavaScript:
39
46
  ```js
40
47
  import Cherryglsl from 'cheryglsljs';
41
- // or import { CherryWave, ImageTransition1 } from 'cheryglsljs';
48
+ // or import { CherryWave, ImageTransition1, ImageTransition2 } from 'cheryglsljs';
42
49
  ```
43
50
 
44
51
  ---
45
52
 
46
53
  ## 🛠️ Usage
47
54
 
48
- ### 1. Wave Effect on an Image
55
+ ### 1. Wave Effect on an Image (`CherryWave`)
49
56
 
50
57
  **HTML:**
51
58
  ```html
52
59
  <div class="container" style="width: 400px; height: 400px;">
53
60
  <img class="cherry" src="your-image.jpg" style="width: 100%; height: 100%;" />
54
61
  </div>
62
+ ```
55
63
 
56
-
57
- **HTML:**
58
- ```html
64
+ **JavaScript:**
65
+ ```js
59
66
  import Cherryglsl from 'cheryglsljs';
60
67
 
61
68
  const img = document.querySelector('.cherry');
62
69
  const container = document.querySelector('.container');
63
70
 
64
- Cherryglsl.default.CherryWave({
65
- image: img,
66
- container: container,
67
- speed: 0.04, // (optional) wave animation speed
68
- strength: 8, // (optional) wave strength
69
- hover: true, // (optional) enable wave on hover
70
- light: false // (optional) enable light effect
71
+ Cherryglsl.CherryWave({
72
+ image: img, // HTMLImageElement (required)
73
+ container: container, // HTMLElement (required)
74
+ speed: 0.04, // (optional) wave animation speed
75
+ strength: 8, // (optional) wave strength
76
+ hover: true, // (optional) enable wave on hover
77
+ light: false // (optional) enable light effect
71
78
  });
79
+ ```
80
+
81
+ #### Parameters for `CherryWave`
82
+ - `image`: HTMLImageElement (required) — The image to apply the wave effect to.
83
+ - `container`: HTMLElement (required) — The container where the effect will be rendered.
84
+ - `speed`: Number (optional, default: 0.05) — Speed of the wave animation.
85
+ - `strength`: Number (optional, default: 8) — Strength/amplitude of the wave.
86
+ - `hover`: Boolean (optional, default: false) — If true, wave animates on hover.
87
+ - `light`: Boolean (optional, default: false) — If true, adds a light effect to the wave.
72
88
 
89
+ ---
90
+
91
+ ### 2. Image Transition Effect 1 (`ImageTransition1`)
92
+
93
+ **HTML:**
94
+ ```html
95
+ <div class="container" style="width: 400px; height: 400px;">
96
+ <img src="image1.jpg" />
97
+ <img src="image2.jpg" />
98
+ </div>
99
+ ```
73
100
 
101
+ **JavaScript:**
102
+ ```js
103
+ import Cherryglsl from 'cheryglsljs';
74
104
 
105
+ const container = document.querySelector('.container');
106
+ Cherryglsl.ImageTransition1(container, {
107
+ speed: 0.02, // (optional) transition speed
108
+ strength: 0.02, // (optional) wave strength during transition
109
+ radius: 0.02, // (optional) radius of the transition circle
110
+ hover: false, // (optional) enable hover effect
111
+ noise: 0.4, // (optional) noise amount for edge
112
+ p: 0.0 // (optional) camera z offset
113
+ });
114
+ ```
75
115
 
116
+ #### Parameters for `ImageTransition1`
117
+ - `container`: HTMLElement (required) — The container with at least two `<img>` elements.
118
+ - `speed`: Number (optional, default: 0.02) — Speed of the transition animation.
119
+ - `strength`: Number (optional, default: 0.02) — Strength of the wave during transition.
120
+ - `radius`: Number (optional, default: 0.02) — Radius of the transition circle.
121
+ - `hover`: Boolean (optional, default: false) — If true, enables hover-based transition.
122
+ - `noise`: Number (optional, default: 0.4) — Amount of noise for the transition edge.
123
+ - `p`: Number (optional, default: 0.0) — Camera z offset for perspective.
76
124
 
125
+ ---
77
126
 
127
+ ### 3. Image Transition Effect 2 (`ImageTransition2`)
78
128
 
79
- ### 2. Image Transition Effect
129
+ **HTML:**
130
+ ```html
131
+ <div class="container" style="width: 400px; height: 400px;">
132
+ <img src="image1.jpg" />
133
+ <img src="image2.jpg" />
134
+ <img src="image3.jpg" />
135
+ </div>
136
+ ```
80
137
 
138
+ **JavaScript:**
139
+ ```js
81
140
  import Cherryglsl from 'cheryglsljs';
82
141
 
83
142
  const container = document.querySelector('.container');
84
- Cherryglsl.default.ImageTransition(Container,{
85
-
86
- radius:0.05,
87
- speed:0.04,
88
- strength:0.2,hover:true,
89
- noise:6
143
+ Cherryglsl.ImageTransition2(container, {
144
+ time: true, // (optional) auto transition timing
145
+ speed: 1.2, // (optional) transition speed
146
+ p: 0.0, // (optional) camera z offset
147
+ hover: false, // (optional) enable hover effect
148
+ ttype: 0 // (optional) transition type (future use)
90
149
  });
150
+ ```
151
+
152
+ #### Parameters for `ImageTransition2`
153
+ - `container`: HTMLElement (required) — The container with at least two `<img>` elements.
154
+ - `time`: Boolean (optional, default: true) — If true, transitions automatically.
155
+ - `speed`: Number (optional, default: 1.2) — Speed of the transition.
156
+ - `p`: Number (optional, default: 0.0) — Camera z offset for perspective.
157
+ - `hover`: Boolean (optional, default: false) — If true, enables hover-based transition.
158
+ - `ttype`: Number (optional, default: 0) — Transition type (for future extension).
159
+
160
+ ---
161
+
162
+ ## 📚 API Summary
163
+
164
+ - `CherryWave(options)` — Adds a wave effect to a single image.
165
+ - `ImageTransition1(container, options)` — Adds a circular transition effect between two images.
166
+ - `ImageTransition2(container, options)` — Adds an animated transition effect between multiple images.
167
+
168
+ ---
169
+
170
+ ## 📝 License
171
+
172
+ MIT