mirror of
https://github.com/FunkinCrew/Funkin.git
synced 2024-11-30 03:25:47 -05:00
Make the ZoomCamera events use sensible defaults.
This commit is contained in:
parent
a42524987e
commit
83e8865a24
1 changed files with 13 additions and 13 deletions
|
@ -52,6 +52,11 @@ class ZoomCameraSongEvent extends SongEvent
|
||||||
super('ZoomCamera');
|
super('ZoomCamera');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static final DEFAULT_ZOOM:Float = 1.0;
|
||||||
|
static final DEFAULT_DURATION:Float = 4.0;
|
||||||
|
static final DEFAULT_MODE:String = 'direct';
|
||||||
|
static final DEFAULT_EASE:String = 'linear';
|
||||||
|
|
||||||
public override function handleEvent(data:SongEventData):Void
|
public override function handleEvent(data:SongEventData):Void
|
||||||
{
|
{
|
||||||
// Does nothing if there is no PlayState camera or stage.
|
// Does nothing if there is no PlayState camera or stage.
|
||||||
|
@ -60,25 +65,20 @@ class ZoomCameraSongEvent extends SongEvent
|
||||||
// Does nothing if we are minimal mode.
|
// Does nothing if we are minimal mode.
|
||||||
if (PlayState.instance.isMinimalMode) return;
|
if (PlayState.instance.isMinimalMode) return;
|
||||||
|
|
||||||
var zoom:Null<Float> = data.getFloat('zoom');
|
var zoom:Float = data.getFloat('zoom') ?? DEFAULT_ZOOM;
|
||||||
if (zoom == null) zoom = 1.0;
|
|
||||||
|
|
||||||
var duration:Null<Float> = data.getFloat('duration');
|
var duration:Float = data.getFloat('duration') ?? DEFAULT_DURATION;
|
||||||
if (duration == null) duration = 4.0;
|
|
||||||
|
|
||||||
var mode:Null<String> = data.getString('mode');
|
var mode:String = data.getString('mode') ?? DEFAULT_MODE;
|
||||||
if (mode == null) mode = 'additive';
|
var isDirectMode:Bool = mode == 'direct';
|
||||||
|
|
||||||
var ease:Null<String> = data.getString('ease');
|
var ease:String = data.getString('ease') ?? DEFAULT_EASE;
|
||||||
if (ease == null) ease = 'linear';
|
|
||||||
|
|
||||||
var directMode:Bool = mode == 'direct';
|
|
||||||
|
|
||||||
// If it's a string, check the value.
|
// If it's a string, check the value.
|
||||||
switch (ease)
|
switch (ease)
|
||||||
{
|
{
|
||||||
case 'INSTANT':
|
case 'INSTANT':
|
||||||
PlayState.instance.tweenCameraZoom(zoom, 0, directMode);
|
PlayState.instance.tweenCameraZoom(zoom, 0, isDirectMode);
|
||||||
default:
|
default:
|
||||||
var durSeconds = Conductor.instance.stepLengthMs * duration / 1000;
|
var durSeconds = Conductor.instance.stepLengthMs * duration / 1000;
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ class ZoomCameraSongEvent extends SongEvent
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayState.instance.tweenCameraZoom(zoom, durSeconds, directMode, easeFunction);
|
PlayState.instance.tweenCameraZoom(zoom, durSeconds, isDirectMode, easeFunction);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@ class ZoomCameraSongEvent extends SongEvent
|
||||||
{
|
{
|
||||||
name: 'mode',
|
name: 'mode',
|
||||||
title: 'Mode',
|
title: 'Mode',
|
||||||
defaultValue: 'additive',
|
defaultValue: 'direct',
|
||||||
type: SongEventFieldType.ENUM,
|
type: SongEventFieldType.ENUM,
|
||||||
keys: ['Additive' => 'additive', 'Direct' => 'direct']
|
keys: ['Additive' => 'additive', 'Direct' => 'direct']
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue