Skip to content

Commit

Permalink
add TrSequence (#150)
Browse files Browse the repository at this point in the history
  • Loading branch information
NoSloppy authored Jul 11, 2024
1 parent 1eaa79c commit 1e7952d
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions style_editor.html
Original file line number Diff line number Diff line change
Expand Up @@ -3049,6 +3049,7 @@
AddTransition("TrJoinR<TrFade<500>, TrWipe<500>>");
AddTransition("TrRandom<TrFade<500>, TrWipe<500>, TrBoing<500, 2>>");
AddTransition("TrSelect<Variation,TrFade<500>, TrWipe<500>, TrBoing<500, 2>>");
AddTransition("TrSequence<TrFade<500>, TrWipe<500>, TrBoing<500, 2>>");
AddTransition("TrSmoothFade<300>");
AddTransition("TrWipe<500>");
AddTransition("TrWipeIn<500>");
Expand Down Expand Up @@ -6777,6 +6778,44 @@
return new TrSelectClass(Array.from(arguments));
}

class TrSequenceClass extends TRANSITION {
constructor(ARGS) {
super("Sequence transitions", ARGS);
this.TRANSITIONS = Array.from(ARGS);
for (var i = 0; i < this.TRANSITIONS.length; i++) {
this.add_arg("TRANSITION" + (i + 1), "TRANSITION", "Transition " + (i + 1));
}
this.n_ = -1;
this.begin_ = true;
}

begin() {
this.begin_ = true;
}

run(blade) {
if (this.begin_) {
this.begin_ = false;
this.n_ = (this.n_ + 1) % this.TRANSITIONS.length;
this.selected = this.TRANSITIONS[this.n_];
this.selected.begin();
}
this.selected.run(blade);
}

getColor(A, B, led) {
return this.selected.getColor(A, B, led);
}

done() {
return this.selected && this.selected.done();
}
}

function TrSequence(ARGS) {
return new TrSequenceClass(Array.from(arguments));
}

class TrExtendXClass extends TRANSITION {
constructor(MILLIS, TRANSITION) {
super("Extend a transition.", arguments);
Expand Down Expand Up @@ -8861,6 +8900,7 @@
TrJoinR : TrJoinR,
TrRandom : TrRandom,
TrSelect : TrSelect,
TrSequence : TrSequence,
TrWaveX : TrWaveX,
TrSparkX : TrSparkX,
TrWipeSparkTip : TrWipeSparkTip,
Expand Down

0 comments on commit 1e7952d

Please sign in to comment.