@johnfmorton/some-shade 0.1.4-beta → 1.0.1
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 +100 -19
- package/dist/index.d.ts +79 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -27,9 +27,9 @@ npm install @johnfmorton/some-shade
|
|
|
27
27
|
|
|
28
28
|
## Effects
|
|
29
29
|
|
|
30
|
-
### CMYK Halftone
|
|
30
|
+
### CMYK Halftone (`halftone-cmyk`)
|
|
31
31
|
|
|
32
|
-
Simulates a CMYK halftone print screen with per-channel angle control.
|
|
32
|
+
Simulates a CMYK halftone print screen with per-channel angle control, visibility toggles, and black channel intensity.
|
|
33
33
|
|
|
34
34
|
```html
|
|
35
35
|
<some-shade-image
|
|
@@ -41,10 +41,15 @@ Simulates a CMYK halftone print screen with per-channel angle control.
|
|
|
41
41
|
angle-m="75"
|
|
42
42
|
angle-y="0"
|
|
43
43
|
angle-k="45"
|
|
44
|
+
show-c="1"
|
|
45
|
+
show-m="1"
|
|
46
|
+
show-y="1"
|
|
47
|
+
show-k="1"
|
|
48
|
+
intensity-k="1"
|
|
44
49
|
></some-shade-image>
|
|
45
50
|
```
|
|
46
51
|
|
|
47
|
-
### Duotone Halftone
|
|
52
|
+
### Duotone Halftone (`halftone-duotone`)
|
|
48
53
|
|
|
49
54
|
Halftone effect using a single custom color.
|
|
50
55
|
|
|
@@ -59,7 +64,7 @@ Halftone effect using a single custom color.
|
|
|
59
64
|
></some-shade-image>
|
|
60
65
|
```
|
|
61
66
|
|
|
62
|
-
### Dot Grid
|
|
67
|
+
### Dot Grid (`dot-grid`)
|
|
63
68
|
|
|
64
69
|
Renders the image as a grid of dots with a customizable background.
|
|
65
70
|
|
|
@@ -72,26 +77,102 @@ Renders the image as a grid of dots with a customizable background.
|
|
|
72
77
|
dot-offset-x="0.5"
|
|
73
78
|
dot-offset-y="0.5"
|
|
74
79
|
bg-color="#ffffff"
|
|
80
|
+
angle="0"
|
|
81
|
+
></some-shade-image>
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### 2-Strip Technicolor (`technicolor-2strip`)
|
|
85
|
+
|
|
86
|
+
Simulates the early two-strip Technicolor film process with warm and cool dye channels plus a black (K) channel for detail. Choose between three blend modes for different color mixing behavior.
|
|
87
|
+
|
|
88
|
+
```html
|
|
89
|
+
<some-shade-image
|
|
90
|
+
src="photo.jpg"
|
|
91
|
+
effect="technicolor-2strip"
|
|
92
|
+
dot-radius="7"
|
|
93
|
+
grid-size="10"
|
|
94
|
+
angle-warm="15"
|
|
95
|
+
angle-cool="75"
|
|
96
|
+
angle-k="45"
|
|
97
|
+
show-warm="1"
|
|
98
|
+
show-cool="1"
|
|
99
|
+
show-k="1"
|
|
100
|
+
warm-color="#d94010"
|
|
101
|
+
cool-color="#0da699"
|
|
102
|
+
blend-mode="1"
|
|
103
|
+
intensity-k="1"
|
|
75
104
|
></some-shade-image>
|
|
76
105
|
```
|
|
77
106
|
|
|
107
|
+
**Blend modes:** `0` = Subtractive (dye overlap darkens), `1` = Additive (light overlap brightens), `2` = Screen (soft additive clamping).
|
|
108
|
+
|
|
78
109
|
## Attributes Reference
|
|
79
110
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
|
83
|
-
|
|
84
|
-
| `
|
|
85
|
-
| `
|
|
86
|
-
| `
|
|
87
|
-
| `
|
|
88
|
-
| `
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
|
93
|
-
|
|
94
|
-
| `
|
|
111
|
+
### Universal
|
|
112
|
+
|
|
113
|
+
| Attribute | Type | Default | Description |
|
|
114
|
+
|-----------|------|---------|-------------|
|
|
115
|
+
| `src` | string | `""` | Image source URL |
|
|
116
|
+
| `effect` | string | `"halftone-cmyk"` | Active effect name |
|
|
117
|
+
| `dot-radius` | number | `4` | Dot radius in pixels |
|
|
118
|
+
| `grid-size` | number | `8` | Grid cell size in pixels |
|
|
119
|
+
| `loading-blur` | number | `0` | Blur (px) applied to the source image while the effect renders |
|
|
120
|
+
|
|
121
|
+
### CMYK Halftone
|
|
122
|
+
|
|
123
|
+
| Attribute | Type | Default | Description |
|
|
124
|
+
|-----------|------|---------|-------------|
|
|
125
|
+
| `angle-c` | number | `15` | Cyan channel angle (degrees) |
|
|
126
|
+
| `angle-m` | number | `75` | Magenta channel angle (degrees) |
|
|
127
|
+
| `angle-y` | number | `0` | Yellow channel angle (degrees) |
|
|
128
|
+
| `angle-k` | number | `45` | Black channel angle (degrees) |
|
|
129
|
+
| `show-c` | number | `1` | Show cyan channel (0 or 1) |
|
|
130
|
+
| `show-m` | number | `1` | Show magenta channel (0 or 1) |
|
|
131
|
+
| `show-y` | number | `1` | Show yellow channel (0 or 1) |
|
|
132
|
+
| `show-k` | number | `1` | Show black channel (0 or 1) |
|
|
133
|
+
| `intensity-k` | number | `1` | Black channel intensity multiplier (0–2) |
|
|
134
|
+
|
|
135
|
+
### Duotone Halftone
|
|
136
|
+
|
|
137
|
+
| Attribute | Type | Default | Description |
|
|
138
|
+
|-----------|------|---------|-------------|
|
|
139
|
+
| `duotone-color` | string | `"#0099cc"` | Highlight color (hex) |
|
|
140
|
+
| `angle` | number | `0` | Grid angle (degrees) |
|
|
141
|
+
|
|
142
|
+
### Dot Grid
|
|
143
|
+
|
|
144
|
+
| Attribute | Type | Default | Description |
|
|
145
|
+
|-----------|------|---------|-------------|
|
|
146
|
+
| `dot-offset-x` | number | `0.5` | Horizontal dot offset (0–1) |
|
|
147
|
+
| `dot-offset-y` | number | `0.5` | Vertical dot offset (0–1) |
|
|
148
|
+
| `bg-color` | string | `"#ffffff"` | Background color (hex) |
|
|
149
|
+
| `angle` | number | `0` | Grid angle (degrees) |
|
|
150
|
+
|
|
151
|
+
### 2-Strip Technicolor
|
|
152
|
+
|
|
153
|
+
| Attribute | Type | Default | Description |
|
|
154
|
+
|-----------|------|---------|-------------|
|
|
155
|
+
| `angle-warm` | number | `15` | Warm channel angle (degrees) |
|
|
156
|
+
| `angle-cool` | number | `75` | Cool channel angle (degrees) |
|
|
157
|
+
| `angle-k` | number | `45` | Black channel angle (degrees) |
|
|
158
|
+
| `show-warm` | number | `1` | Show warm channel (0 or 1) |
|
|
159
|
+
| `show-cool` | number | `1` | Show cool channel (0 or 1) |
|
|
160
|
+
| `show-k` | number | `1` | Show black channel (0 or 1) |
|
|
161
|
+
| `warm-color` | string | `"#d94010"` | Warm dye color (hex) |
|
|
162
|
+
| `cool-color` | string | `"#0da699"` | Cool dye color (hex) |
|
|
163
|
+
| `blend-mode` | number | `1` | Blend mode: 0 = Subtractive, 1 = Additive, 2 = Screen |
|
|
164
|
+
| `intensity-k` | number | `1` | Black channel intensity multiplier (0–2) |
|
|
165
|
+
|
|
166
|
+
## Methods
|
|
167
|
+
|
|
168
|
+
### `replayTransition(delay?: number)`
|
|
169
|
+
|
|
170
|
+
Hides the rendered snapshot and fades it back in after a delay. Useful for previewing the loading blur transition.
|
|
171
|
+
|
|
172
|
+
```js
|
|
173
|
+
const el = document.querySelector('some-shade-image');
|
|
174
|
+
el.replayTransition(500);
|
|
175
|
+
```
|
|
95
176
|
|
|
96
177
|
## Framework Usage
|
|
97
178
|
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { CSSResult } from 'lit';
|
|
2
|
+
import { LitElement } from 'lit';
|
|
3
|
+
import { PropertyValues } from 'lit';
|
|
4
|
+
import { TemplateResult } from 'lit';
|
|
5
|
+
|
|
6
|
+
export declare interface EffectDefinition {
|
|
7
|
+
name: string;
|
|
8
|
+
fragmentShader: string;
|
|
9
|
+
vertexShader: string;
|
|
10
|
+
uniforms: UniformDefinition[];
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export declare function get(name: string): EffectDefinition | undefined;
|
|
14
|
+
|
|
15
|
+
export declare function list(): string[];
|
|
16
|
+
|
|
17
|
+
export declare function register(effect: EffectDefinition): void;
|
|
18
|
+
|
|
19
|
+
export declare class SomeShadeImage extends LitElement {
|
|
20
|
+
static styles: CSSResult;
|
|
21
|
+
src: string;
|
|
22
|
+
effect: string;
|
|
23
|
+
dotRadius: number;
|
|
24
|
+
gridSize: number;
|
|
25
|
+
angleC: number;
|
|
26
|
+
angleM: number;
|
|
27
|
+
angleY: number;
|
|
28
|
+
angleK: number;
|
|
29
|
+
showC: number;
|
|
30
|
+
showM: number;
|
|
31
|
+
showY: number;
|
|
32
|
+
showK: number;
|
|
33
|
+
intensityK: number;
|
|
34
|
+
duotoneColor: string;
|
|
35
|
+
angle: number;
|
|
36
|
+
dotOffsetX: number;
|
|
37
|
+
dotOffsetY: number;
|
|
38
|
+
bgColor: string;
|
|
39
|
+
angleWarm: number;
|
|
40
|
+
angleCool: number;
|
|
41
|
+
showWarm: number;
|
|
42
|
+
showCool: number;
|
|
43
|
+
warmColor: string;
|
|
44
|
+
coolColor: string;
|
|
45
|
+
blendMode: number;
|
|
46
|
+
loadingBlur: number;
|
|
47
|
+
private _webglAvailable;
|
|
48
|
+
private _snapshotUrl;
|
|
49
|
+
private _snapshotLoaded;
|
|
50
|
+
private _image;
|
|
51
|
+
private _observer;
|
|
52
|
+
private _resizeObserver;
|
|
53
|
+
private _lastClientWidth;
|
|
54
|
+
private _visible;
|
|
55
|
+
private _needsRender;
|
|
56
|
+
render(): TemplateResult<1>;
|
|
57
|
+
connectedCallback(): void;
|
|
58
|
+
updated(changed: PropertyValues): void;
|
|
59
|
+
disconnectedCallback(): void;
|
|
60
|
+
private _loadImage;
|
|
61
|
+
private _scheduleRender;
|
|
62
|
+
private _renderEffect;
|
|
63
|
+
private _onSnapshotLoad;
|
|
64
|
+
/** Hide the rendered snapshot momentarily, then fade it back in.
|
|
65
|
+
* Useful for previewing the loading-blur transition. */
|
|
66
|
+
replayTransition(delay?: number): void;
|
|
67
|
+
private _revokeSnapshot;
|
|
68
|
+
private _getUniformValues;
|
|
69
|
+
private _parseHexColor;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export declare interface UniformDefinition {
|
|
73
|
+
name: string;
|
|
74
|
+
type: 'float' | 'vec2' | 'vec3' | 'vec4';
|
|
75
|
+
default: number | number[];
|
|
76
|
+
attribute?: string;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export { }
|