lexgui 0.1.36 → 0.1.39
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 +70 -19
- package/build/components/audio.js +174 -0
- package/build/components/timeline.js +2958 -3260
- package/build/components/videoeditor.js +10 -2
- package/build/lexgui.css +117 -2
- package/build/lexgui.js +825 -257
- package/build/lexgui.module.js +794 -297
- package/changelog.md +32 -2
- package/demo.js +9 -2
- package/examples/timeline.html +33 -21
- package/package.json +1 -1
package/changelog.md
CHANGED
|
@@ -1,10 +1,40 @@
|
|
|
1
1
|
# lexgui.js changelog
|
|
2
2
|
|
|
3
|
-
## 0.1.
|
|
3
|
+
## 0.1.40 (dev)
|
|
4
4
|
|
|
5
|
+
## 0.1.39 (master)
|
|
5
6
|
|
|
7
|
+
New widget: Pad. Bidimensional slider.
|
|
8
|
+
`LX.makeDraggable` now supports 'absolute' and 'fixed' positions.
|
|
9
|
+
Fix passing onDragStart/onMove functions to Dialogs.
|
|
10
|
+
Minor bug fixes.
|
|
11
|
+
|
|
12
|
+
## 0.1.38
|
|
13
|
+
|
|
14
|
+
Timeline: Fixed timeline signals and added callbacks
|
|
15
|
+
|
|
16
|
+
Number/Vector widgets:
|
|
17
|
+
- Support for onPress&onRelease for catching mouse events.
|
|
18
|
+
- Added `setLimits` for min, max, step parameters.
|
|
19
|
+
|
|
20
|
+
Added Size Widget (N dimension number widget).
|
|
21
|
+
Minor bug fixes.
|
|
22
|
+
|
|
23
|
+
## 0.1.37
|
|
24
|
+
|
|
25
|
+
Audio:
|
|
26
|
+
- Start new audio widgets (Knob wip).
|
|
27
|
+
|
|
28
|
+
Timeline:
|
|
29
|
+
- Major refactor of Timeline
|
|
30
|
+
- Fixed examples
|
|
31
|
+
|
|
32
|
+
Allow unit labels for Number widgets.
|
|
33
|
+
Fixed Number/Vector precision.
|
|
34
|
+
Fixed ContextMenu position on creation over window size.
|
|
35
|
+
Minor bug fixes.
|
|
6
36
|
|
|
7
|
-
## 0.1.36
|
|
37
|
+
## 0.1.36
|
|
8
38
|
|
|
9
39
|
Default skipCallback as `true` on emit widget signal.
|
|
10
40
|
Add some vec2 math functions.
|
package/demo.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { LX } from 'lexgui';
|
|
2
2
|
import 'lexgui/components/codeeditor.js';
|
|
3
3
|
import 'lexgui/components/timeline.js';
|
|
4
|
+
import 'lexgui/components/audio.js';
|
|
4
5
|
|
|
5
6
|
window.LX = LX;
|
|
6
7
|
|
|
@@ -480,10 +481,15 @@ function fillPanel( panel ) {
|
|
|
480
481
|
panel.sameLine(2);
|
|
481
482
|
panel.addFile("Img1", data => { console.log(data) }, {} );
|
|
482
483
|
panel.addFile("Img2", data => { console.log(data) }, {} );
|
|
484
|
+
panel.addPad("2D Pad", [0.5, 0.5], (value, event) => {
|
|
485
|
+
console.log(value);
|
|
486
|
+
}, { padSize: "100px", min: -1, max: 2 });
|
|
487
|
+
panel.addSize("Screen Res", [1280, 720], (value, event) => {
|
|
488
|
+
console.log(value);
|
|
489
|
+
}, { units: "p" });
|
|
483
490
|
panel.addDropdown("Best Engine", ["Godot", "Unity", "Unreal Engine"], "Unity", (value, event) => {
|
|
484
491
|
console.log(value);
|
|
485
492
|
});
|
|
486
|
-
|
|
487
493
|
panel.addDropdown("Best Logo", [{value:"Godot", src: "https://godotengine.org/assets/press/logo_vertical_color_light.webp"}, {value: "Unity", src: "https://logos-world.net/wp-content/uploads/2023/01/Unity-Logo.png"}, {value:"Unreal Engine", src: "https://cdn2.unrealengine.com/ue-logo-stacked-unreal-engine-w-677x545-fac11de0943f.png"}], "Godot", (value, event) => {
|
|
488
494
|
console.log(value);
|
|
489
495
|
}, {filter: true});
|
|
@@ -547,7 +553,7 @@ function fillPanel( panel ) {
|
|
|
547
553
|
});
|
|
548
554
|
panel.addNumber("Font Size", 36, (value, event) => {
|
|
549
555
|
console.log(value);
|
|
550
|
-
}, { min: 1, max: 48, step: 1});
|
|
556
|
+
}, { min: 1, max: 48, step: 1, units: "px"});
|
|
551
557
|
panel.addVector2("2D Position", [250, 350], (value, event) => {
|
|
552
558
|
console.log(value);
|
|
553
559
|
}, { min: 0, max: 1024 });
|
|
@@ -692,6 +698,7 @@ function fillBottomPanel( panel ) {
|
|
|
692
698
|
panel.addTextArea("Notes", "", (value, event) => {
|
|
693
699
|
console.log(value);
|
|
694
700
|
}, { placeholder: 'Some notes...' });
|
|
701
|
+
panel.addKnob("A Knob", 4, 0, 200, value => { console.log(value) }, /*{ size: 'sm' }*/);
|
|
695
702
|
panel.addButton("Apply", "Add button to branch", (value, event) => {
|
|
696
703
|
const branch = panel.getBranch("Information");
|
|
697
704
|
panel.queue( branch.content );
|
package/examples/timeline.html
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
<script type="module">
|
|
19
19
|
|
|
20
20
|
import { LX } from 'lexgui';
|
|
21
|
-
import { Timeline, KeyFramesTimeline, ClipsTimeline, CurvesTimeline
|
|
21
|
+
import { Timeline, KeyFramesTimeline, ClipsTimeline, CurvesTimeline } from 'lexgui/components/timeline.js';
|
|
22
22
|
|
|
23
23
|
// init library and get main area
|
|
24
24
|
let area = LX.init();
|
|
@@ -123,8 +123,16 @@
|
|
|
123
123
|
console.log(value);
|
|
124
124
|
}, { min: 1, max: 48, step: 1});
|
|
125
125
|
panel.addVector2("2D Position", position, (value, event) => {
|
|
126
|
-
|
|
127
|
-
|
|
126
|
+
let currentSelection = activeTimeline.lastKeyFramesSelected[0];
|
|
127
|
+
if( currentSelection ){
|
|
128
|
+
const track = activeTimeline.animationClip.tracks[0];
|
|
129
|
+
const keyframe = currentSelection[2];
|
|
130
|
+
const dim = track.dim;
|
|
131
|
+
|
|
132
|
+
track.values[keyframe * track.dim] = value[0];
|
|
133
|
+
track.values[keyframe * track.dim + 1] = value[1];
|
|
134
|
+
track.edited[keyframe] = true;
|
|
135
|
+
}
|
|
128
136
|
}, { min: 0, max: 1024 });
|
|
129
137
|
panel.branch_open = true;
|
|
130
138
|
panel.merge();
|
|
@@ -177,7 +185,7 @@
|
|
|
177
185
|
keyframesPanel.onresize = () => {
|
|
178
186
|
kfTimeline.resize();
|
|
179
187
|
}
|
|
180
|
-
let kfTimeline = new LX.KeyFramesTimeline('', {
|
|
188
|
+
let kfTimeline = new LX.KeyFramesTimeline('keyframesTimeline', {
|
|
181
189
|
disableNewTracks: true,
|
|
182
190
|
onBeforeCreateTopBar: (panel) => {
|
|
183
191
|
panel.addDropdown("Animation", ["Anim 1", "Anim 2", "Anim 3"], "Anim 1", ()=> {})
|
|
@@ -189,13 +197,13 @@
|
|
|
189
197
|
});
|
|
190
198
|
|
|
191
199
|
keyframesPanel.attach(kfTimeline.root);
|
|
200
|
+
kfTimeline.setAnimationClip({tracks: [{name: "Font.position", values: [250, 450, 250, 250, 250, 450], times: [0, 0.5, 1.0]}, {name: "Item 1.scale", values: [0,1,0, 0.5], times: [0, 0.1, 0.2, 0.3]}, {name: "Item 2", values: [0,1,0,1], times: [0.1]}, {name: "Item 3.position", values: [0,1,0,0,0,0], times: [0.1, 0.2, 0.3]}, {name: "Item 3.scale", values: [0,1,0], times: [ 0.1, 0.2, 0.3]}], duration: 1});
|
|
192
201
|
kfTimeline.setSelectedItems(["Font", "Item 2", "Item 3"]);
|
|
193
|
-
kfTimeline.setAnimationClip({tracks: [{name: "Font.position", values: [250, 350, 250, 250, 250, 350], times: [0, 0.1, 0.2]}, {name: "Item 1.scale", values: [0,1,0, 0.5], times: [0, 0.1, 0.2, 0.3]}, {name: "Item 2", values: [0,1,0,1], times: [0.1]}, {name: "Item 3.position", values: [0,1,0,0,0,0], times: [0.1, 0.2, 0.3]}, {name: "Item 3.scale", values: [0,1,0], times: [ 0.1, 0.2, 0.3]}], duration: 1});
|
|
194
202
|
activeTimeline = kfTimeline;
|
|
195
203
|
kfTimeline.show();
|
|
196
204
|
|
|
197
205
|
|
|
198
|
-
kfTimeline.onSelectKeyFrame = (data, currentSelection
|
|
206
|
+
kfTimeline.onSelectKeyFrame = (data, currentSelection) => {
|
|
199
207
|
if(data.multipleSelection) {
|
|
200
208
|
rightArea.hide();
|
|
201
209
|
return;
|
|
@@ -209,6 +217,8 @@
|
|
|
209
217
|
let values = kfTimeline.animationClip.tracks[id].values;
|
|
210
218
|
const dim = kfTimeline.animationClip.tracks[id].dim;
|
|
211
219
|
|
|
220
|
+
//currentSelection == [track.name, track.idx, frameIdx, track.clipIdx, track.times[frameIdx]]
|
|
221
|
+
const keyFrameIndex = currentSelection[2];
|
|
212
222
|
position = values.slice(keyFrameIndex * dim, keyFrameIndex * dim + dim);
|
|
213
223
|
fillPanel(panel);
|
|
214
224
|
//kfTimeline.animationClip.tracks[currentSelection[0][0]];
|
|
@@ -216,21 +226,23 @@
|
|
|
216
226
|
|
|
217
227
|
kfTimeline.onSetTime = ( time ) => {
|
|
218
228
|
rightArea.show();
|
|
219
|
-
const
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
let
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
valueX = valueX * (1 - t) + values[keyframe * 2 + sign] * t;
|
|
230
|
-
valueY = valueY * (1 - t) + values[keyframe * 2 + sign + 1] * t;
|
|
229
|
+
const keyframe = kfTimeline.getNearestKeyFrame( kfTimeline.animationClip.tracks[0], time, -1);
|
|
230
|
+
if(keyframe != -1) {
|
|
231
|
+
const trackLength = kfTimeline.animationClip.tracks[0].times.length;
|
|
232
|
+
const nextKeyframe = keyframe < (trackLength-1) ? (keyframe + 1) : keyframe;
|
|
233
|
+
const frametime = kfTimeline.animationClip.tracks[0].times[keyframe];
|
|
234
|
+
const nextframeTime = kfTimeline.animationClip.tracks[0].times[nextKeyframe];
|
|
235
|
+
|
|
236
|
+
let t = 1;
|
|
237
|
+
if ( keyframe < trackLength-1){
|
|
238
|
+
t = (time - frametime) / (nextframeTime - frametime);
|
|
231
239
|
}
|
|
240
|
+
|
|
241
|
+
let values = kfTimeline.animationClip.tracks[0].values;
|
|
242
|
+
let valueX = values[keyframe * 2] * (1-t) + t * values[nextKeyframe * 2];
|
|
243
|
+
let valueY = values[keyframe * 2 + 1] * (1-t) + t * values[nextKeyframe * 2 + 1];
|
|
244
|
+
position = [valueX, valueY];
|
|
232
245
|
}
|
|
233
|
-
position = [valueX, valueY];
|
|
234
246
|
fillPanel( panel );
|
|
235
247
|
}
|
|
236
248
|
}
|
|
@@ -282,10 +294,10 @@
|
|
|
282
294
|
|
|
283
295
|
}});
|
|
284
296
|
|
|
285
|
-
let curvesTimeline = new LX.
|
|
297
|
+
let curvesTimeline = new LX.CurvesTimeline("curves-timeline", { range: [-1,1]});
|
|
286
298
|
curvesPanel.attach(curvesTimeline.root);
|
|
287
|
-
curvesTimeline.setSelectedItems(["Item 1", "Item 2", "Item 3"]);
|
|
288
299
|
curvesTimeline.setAnimationClip({tracks: [{name: "Item 1.position", values: [0,1,0,-1], times: [0, 0.1, 0.2, 0.3]}, {name: "Item 1.scale", values: [0,1,0, 0.5], times: [0, 0.1, 0.2, 0.3]}, {name: "Item 2", values: [0,1,0,1], times: [0.1, 0.2, 0.3, 0.8]}, {name: "Item 3.position", values: [0,0,1], times: [0]}, {name: "Item 3.scale", values: [0,1,0], times: [0, 0.1, 0.3]}], duration: 1});
|
|
300
|
+
curvesTimeline.setSelectedItems(["Item 1", "Item 2", "Item 3"]);
|
|
289
301
|
curvesTimeline.show();
|
|
290
302
|
curvesTimeline.draw(0);
|
|
291
303
|
}
|