lexgui 0.1.35 → 0.1.37
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 +75 -16
- package/build/components/audio.js +179 -0
- package/build/components/timeline.js +2761 -3119
- package/build/components/videoeditor.js +10 -2
- package/build/lexgui.css +93 -9
- package/build/lexgui.js +384 -225
- package/build/lexgui.module.js +367 -220
- package/changelog.md +22 -1
- package/demo.js +14 -7
- package/examples/timeline.html +33 -21
- package/package.json +1 -1
package/changelog.md
CHANGED
|
@@ -1,6 +1,27 @@
|
|
|
1
1
|
# lexgui.js changelog
|
|
2
2
|
|
|
3
|
-
## 0.1.
|
|
3
|
+
## 0.1.37
|
|
4
|
+
|
|
5
|
+
Audio:
|
|
6
|
+
- Start new audio widgets (Knob wip).
|
|
7
|
+
|
|
8
|
+
Timeline:
|
|
9
|
+
- Major refactor of Timeline
|
|
10
|
+
- Fixed examples
|
|
11
|
+
|
|
12
|
+
Allow unit labels for Number widgets.
|
|
13
|
+
Fixed Number/Vector precision.
|
|
14
|
+
Fixed ContextMenu position on creation over window size.
|
|
15
|
+
Minor bug fixes.
|
|
16
|
+
|
|
17
|
+
## 0.1.36 (master)
|
|
18
|
+
|
|
19
|
+
Default skipCallback as `true` on emit widget signal.
|
|
20
|
+
Add some vec2 math functions.
|
|
21
|
+
`Panel.addTabs` support for onCreate (prev. `callback`) and onSelect callbacks.
|
|
22
|
+
Apply original `display` when showing Areatab.
|
|
23
|
+
Minor styling tweaks.
|
|
24
|
+
Documentation updates.
|
|
4
25
|
|
|
5
26
|
## 0.1.35
|
|
6
27
|
|
package/demo.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
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';
|
|
5
|
+
|
|
6
|
+
window.LX = LX;
|
|
4
7
|
|
|
5
8
|
// Init library and get main area
|
|
6
9
|
let area = LX.init();
|
|
@@ -475,6 +478,7 @@ function fillPanel( panel ) {
|
|
|
475
478
|
panel.branch("Preferences", {icon: "fa-solid fa-gear"});
|
|
476
479
|
panel.addButton(null, "Click me, Im Full Width...");
|
|
477
480
|
panel.addText("Text", "Warning text", null, { warning: true });
|
|
481
|
+
panel.addKnob("A Knob", 4, 0, 200, value => { console.log(value) }, /*{ size: 'sm' }*/);
|
|
478
482
|
panel.sameLine(2);
|
|
479
483
|
panel.addFile("Img1", data => { console.log(data) }, {} );
|
|
480
484
|
panel.addFile("Img2", data => { console.log(data) }, {} );
|
|
@@ -545,7 +549,7 @@ function fillPanel( panel ) {
|
|
|
545
549
|
});
|
|
546
550
|
panel.addNumber("Font Size", 36, (value, event) => {
|
|
547
551
|
console.log(value);
|
|
548
|
-
}, { min: 1, max: 48, step: 1});
|
|
552
|
+
}, { min: 1, max: 48, step: 1, units: "px"});
|
|
549
553
|
panel.addVector2("2D Position", [250, 350], (value, event) => {
|
|
550
554
|
console.log(value);
|
|
551
555
|
}, { min: 0, max: 1024 });
|
|
@@ -582,15 +586,18 @@ function fillRightBottomPanel( panel, tab ) {
|
|
|
582
586
|
{
|
|
583
587
|
name: "First tab",
|
|
584
588
|
icon: "fa-brands fa-discord",
|
|
585
|
-
|
|
589
|
+
onCreate: p => {
|
|
586
590
|
p.addTitle("Discord tab");
|
|
587
591
|
p.addButton(null, "Connect");
|
|
592
|
+
},
|
|
593
|
+
onSelect: p => {
|
|
594
|
+
console.log( p );
|
|
588
595
|
}
|
|
589
596
|
},
|
|
590
597
|
{
|
|
591
598
|
name: "Second tab",
|
|
592
599
|
icon: "fa-brands fa-twitter",
|
|
593
|
-
|
|
600
|
+
onCreate: p => {
|
|
594
601
|
p.addTitle("Twitter tab");
|
|
595
602
|
p.addText("Tweet", "", null, {placeholder: "Tyler Rake 2"});
|
|
596
603
|
}
|
|
@@ -598,7 +605,7 @@ function fillRightBottomPanel( panel, tab ) {
|
|
|
598
605
|
{
|
|
599
606
|
name: "Third tab",
|
|
600
607
|
icon: "fa-brands fa-github",
|
|
601
|
-
|
|
608
|
+
onCreate: p => {
|
|
602
609
|
p.addTitle("Github tab");
|
|
603
610
|
p.addButton(null, "Go", () => {window.open("https://github.com/jxarco/lexgui.js/")});
|
|
604
611
|
}
|
|
@@ -621,7 +628,7 @@ function fillRightBottomPanel( panel, tab ) {
|
|
|
621
628
|
{
|
|
622
629
|
name: "First tab",
|
|
623
630
|
icon: "fa-brands fa-discord",
|
|
624
|
-
|
|
631
|
+
onCreate: (p, content) => {
|
|
625
632
|
p.addTitle("Discord tab");
|
|
626
633
|
p.addButton("Apply", "Add button to branch", (value, event) => {
|
|
627
634
|
p.queue( content );
|
|
@@ -633,7 +640,7 @@ function fillRightBottomPanel( panel, tab ) {
|
|
|
633
640
|
{
|
|
634
641
|
name: "Second tab",
|
|
635
642
|
icon: "fa-brands fa-twitter",
|
|
636
|
-
|
|
643
|
+
onCreate: p => {
|
|
637
644
|
p.addTitle("Twitter tab");
|
|
638
645
|
p.addText("Tweet", "", null, {placeholder: "Tyler Rake 2"});
|
|
639
646
|
}
|
|
@@ -641,7 +648,7 @@ function fillRightBottomPanel( panel, tab ) {
|
|
|
641
648
|
{
|
|
642
649
|
name: "Third tab",
|
|
643
650
|
icon: "fa-brands fa-github",
|
|
644
|
-
|
|
651
|
+
onCreate: p => {
|
|
645
652
|
p.addTitle("Github tab");
|
|
646
653
|
p.addButton(null, "Go", (value, event) => {window.open("https://github.com/jxarco/lexgui.js/")});
|
|
647
654
|
}
|
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
|
}
|