forgor vslice shits + better camera tweens

hopefully works, sen pls test these with your vslice charts🥹
This commit is contained in:
⍚~Nex
2025-05-04 22:34:53 +02:00
parent 5751ad5d43
commit 921ab3da63
3 changed files with 31 additions and 11 deletions
+8 -5
View File
@@ -36,18 +36,21 @@ class EventsData {
"Camera Position" => [ "Camera Position" => [
{name: "X", type: TFloat(null, null, 10, 3), defValue: 0}, {name: "X", type: TFloat(null, null, 10, 3), defValue: 0},
{name: "Y", type: TFloat(null, null, 10, 3), defValue: 0}, {name: "Y", type: TFloat(null, null, 10, 3), defValue: 0},
{name: "Tween Movement?", type: TBool, defValue: true}, {name: "Tween Movement?", type: TBool, defValue: true, saveIfDefault: false},
{name: "Tween Time (Steps, IF NOT CLASSIC)", type: TFloat(0.25, 9999, 0.25, 2), defValue: 4}, {name: "Tween Time (Steps, IF NOT CLASSIC)", type: TFloat(0.25, 9999, 0.25, 2), defValue: 4, saveIfDefault: false},
{ {
name: "Tween Ease (ex: circ, quad, cube)", name: "Tween Ease (ex: circ, quad, cube)",
type: TDropDown(['CLASSIC', 'linear', 'back', 'bounce', 'circ', 'cube', 'elastic', 'expo', 'quad', 'quart', 'quint', 'sine', 'smoothStep', 'smootherStep']), type: TDropDown(['CLASSIC', 'linear', 'back', 'bounce', 'circ', 'cube', 'elastic', 'expo', 'quad', 'quart', 'quint', 'sine', 'smoothStep', 'smootherStep']),
defValue: "CLASSIC" defValue: "CLASSIC",
saveIfDefault: false
}, },
{ {
name: "Tween Type (excluded if CLASSIC or linear, ex: InOut)", name: "Tween Type (excluded if CLASSIC or linear, ex: InOut)",
type: TDropDown(['In', 'Out', 'InOut']), type: TDropDown(['In', 'Out', 'InOut']),
defValue: "In" defValue: "In",
} saveIfDefault: false
},
{name: "Is Offset?", type: TBool, defValue: false, saveIfDefault: false}
], ],
"Add Camera Zoom" => [ "Add Camera Zoom" => [
{name: "Amount", type: TFloat(-10, 10, 0.01, 2), defValue: 0.05}, {name: "Amount", type: TFloat(-10, 10, 0.01, 2), defValue: 0.05},
+8 -1
View File
@@ -108,8 +108,10 @@ class VSliceParser {
{ {
case "FocusCamera": case "FocusCamera":
var arr:Array<Dynamic> = [switch(values.char) { var arr:Array<Dynamic> = [switch(values.char) {
// more cases here in the future if they add em? (i hope not) - Nex
case 0: 1; case 0: 1;
case 1: 0; case 1: 0;
case -1: -1;
default: 2; default: 2;
}]; }];
if (values.ease != "CLASSIC" && values.ease != null) { if (values.ease != "CLASSIC" && values.ease != null) {
@@ -119,7 +121,12 @@ class VSliceParser {
arr = arr.concat([true, values.duration == null ? 4 : values.duration, cneEase[0], cneEase[1]]); arr = arr.concat([true, values.duration == null ? 4 : values.duration, cneEase[0], cneEase[1]]);
} }
} }
result.events.push({ if (values.x != null || values.y != null) result.events.push({
time: event.t,
name: "Camera Position",
params: [values.x, values.y, arr[1], arr[2], arr[3], arr[4], true]
});
if (arr[0] != -1) result.events.push({
time: event.t, time: event.t,
name: "Camera Movement", name: "Camera Movement",
params: arr params: arr
+15 -5
View File
@@ -1463,7 +1463,6 @@ class PlayState extends MusicBeatState
if (func != null && Reflect.isFunction(func)) if (func != null && Reflect.isFunction(func))
Reflect.callMethod(null, func, args); Reflect.callMethod(null, func, args);
} }
case "Camera Movement": case "Camera Movement":
var tween = eventsTween.get("cameraMovement"); var tween = eventsTween.get("cameraMovement");
if (tween != null) tween.cancel(); if (tween != null) tween.cancel();
@@ -1474,9 +1473,14 @@ class PlayState extends MusicBeatState
moveCamera(); moveCamera();
FlxG.camera.snapToTarget(); FlxG.camera.snapToTarget();
} else if (event.params[3] != null && event.params[3] != "CLASSIC") { // making more nullchecks in this event because of the default save value being false - Nex } else if (event.params[3] != null && event.params[3] != "CLASSIC") { // making more nullchecks in this event because of the default save value being false - Nex
moveCamera(); // i feel like i shouldnt nullify the camera target or else is gonna be annoying when scripts cancel the tween with setting back the target onComplete - Nex moveCamera();
var oldFollow = FlxG.camera.followEnabled;
FlxG.camera.followEnabled = false;
eventsTween.set("cameraMovement", FlxTween.tween(FlxG.camera.scroll, {x: camFollow.x - FlxG.camera.width * 0.5, y: camFollow.y - FlxG.camera.height * 0.5}, eventsTween.set("cameraMovement", FlxTween.tween(FlxG.camera.scroll, {x: camFollow.x - FlxG.camera.width * 0.5, y: camFollow.y - FlxG.camera.height * 0.5},
(Conductor.stepCrochet / 1000) * (event.params[2] == null ? 4 : event.params[2]), {ease: CoolUtil.flxeaseFromString(event.params[3], event.params[4])}) (Conductor.stepCrochet / 1000) * (event.params[2] == null ? 4 : event.params[2]), {
ease: CoolUtil.flxeaseFromString(event.params[3], event.params[4]),
onComplete: (_) -> FlxG.camera.followEnabled = oldFollow
})
); );
} }
} }
@@ -1485,13 +1489,19 @@ class PlayState extends MusicBeatState
if (tween != null) tween.cancel(); if (tween != null) tween.cancel();
curCameraTarget = -1; curCameraTarget = -1;
camFollow.setPosition(event.params[0], event.params[1]); var isOffset = event.params[6] == "true";
camFollow.setPosition(isOffset ? camFollow.x + event.params[0] : event.params[0], isOffset ? camFollow.y + event.params[1] : event.params[1]);
if (event.params[2] == false) { if (event.params[2] == false) {
FlxG.camera.snapToTarget(); FlxG.camera.snapToTarget();
} else if (event.params[4] != "CLASSIC") { } else if (event.params[4] != "CLASSIC") {
var oldFollow = FlxG.camera.followEnabled;
FlxG.camera.followEnabled = false;
eventsTween.set("cameraMovement", FlxTween.tween(FlxG.camera.scroll, {x: camFollow.x - FlxG.camera.width * 0.5, y: camFollow.y - FlxG.camera.height * 0.5}, eventsTween.set("cameraMovement", FlxTween.tween(FlxG.camera.scroll, {x: camFollow.x - FlxG.camera.width * 0.5, y: camFollow.y - FlxG.camera.height * 0.5},
(Conductor.stepCrochet / 1000) * event.params[3], {ease: CoolUtil.flxeaseFromString(event.params[4], event.params[5])}) (Conductor.stepCrochet / 1000) * event.params[3], {
ease: CoolUtil.flxeaseFromString(event.params[4], event.params[5]),
onComplete: (_) -> FlxG.camera.followEnabled = oldFollow
})
); );
} }
case "Add Camera Zoom": case "Add Camera Zoom":