Animated Opening – Arma 3
Argiolasric (talk | contribs) |
Argiolasric (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
= Overview = | |||
The ''Animated Opening'' framework allows you to easily create campaign openings by animating pictures using a timeline. | The ''Animated Opening'' framework allows you to easily create campaign openings by animating pictures using a timeline. | ||
Line 8: | Line 8: | ||
* Skippable | * Skippable | ||
= Framework = | |||
== Functionality == | |||
The framework provides the designer with simple ways to manage picture and texts and to quickly animate them efficiently. The framework also lets you organize pictures and text in layers so that you can easily manage which pictures stay on top on which stay on the bottom. It provides several ways to animate pictures: scaling, moving, rotating, blinking/pulsing and fading. | The framework provides the designer with simple ways to manage picture and texts and to quickly animate them efficiently. The framework also lets you organize pictures and text in layers so that you can easily manage which pictures stay on top on which stay on the bottom. It provides several ways to animate pictures: scaling, moving, rotating, blinking/pulsing and fading. | ||
Line 447: | Line 447: | ||
| (opt) BOOL: If true, script sleeps until the fading is complete | | (opt) BOOL: If true, script sleeps until the fading is complete | ||
|} | |} | ||
= Setup and Usage = | |||
A Timeline needs to be prepared before calling the Animated Opening function. | |||
'''Timeline''' | |||
* A timeline is a multi-dimensional array in which each element consists of a time (represented by a number) and an event (a piece of code). | |||
* The timeline starts counting from 0 when it is created. | |||
* When the time specified in a timeline's element has elapsed, its relative event is spawned. | |||
* The timeline stops once it reaches the last element. The last element's code can also be empty if you're just using the element as an ending point. | |||
* The timeline can be kept in a separate file and included using #include "timelineFile.sqf"; within the file calling the animated opening.<syntaxhighlight lang="cpp"> | |||
private _timeline = | |||
[ | |||
[ | |||
0, | |||
{ | |||
[MODE_RESET,[true,true]] call bis_fnc_animatedScreen; | |||
[MODE_BLACKIN,0,false] call bis_fnc_animatedScreen; | |||
} | |||
], | |||
[ | |||
1.5, | |||
{ | |||
[MODE_BLACKOUT,3,false] call bis_fnc_animatedScreen; | |||
} | |||
], | |||
[ | |||
8.2, | |||
{ | |||
[MODE_RESET,[true,true]] call bis_fnc_animatedScreen; | |||
[MODE_BLACKOUT, 0.01, true] call bis_fnc_animatedScreen; | |||
[MODE_LAYER_CREATE, C03_SLIDE1_ID_DUST, C03_SLIDE1_IMG_DUST, nil, nil, 1.3 ] call bis_fnc_animatedScreen; | |||
[MODE_LAYER_CREATE, C03_SLIDE1_ID_OBSTACLE, C03_SLIDE1_IMG_OBSTACLE, [0.46,0.45], nil, 1.2 ] call bis_fnc_animatedScreen; | |||
} | |||
], | |||
[ 12, {} ] | |||
]; | |||
</syntaxhighlight> |
Revision as of 14:19, 30 November 2017
Overview
The Animated Opening framework allows you to easily create campaign openings by animating pictures using a timeline.
Features
- Easy to setup
- Timeline based
- Can be easily synced to music or dialogues using the timeline
- Skippable
Framework
Functionality
The framework provides the designer with simple ways to manage picture and texts and to quickly animate them efficiently. The framework also lets you organize pictures and text in layers so that you can easily manage which pictures stay on top on which stay on the bottom. It provides several ways to animate pictures: scaling, moving, rotating, blinking/pulsing and fading.
Systems
BIS_fnc_TO_AnimatedOpening
- Enhanced version of the BIS_fnc_eventTimeline function
- Sets up the opening
- Initializes the animatedScreen function
- Creates the initial black out
- starts the event timeline by calling BIS_fnc_eventTimeline function
- holdKey setup (for skipping the opening)
Parameters
Parameter | Description |
---|---|
timeline | 2D ARRAY: see BIS_fnc_eventTimeline |
pointer | NUMBER: see BIS_fnc_eventTimeline |
music | (opt) - STRING: see BIS_fnc_eventTimeline |
BIS_fnc_eventTimeline
- Essential system of the Animated Briefings, but the function can be used for different purposes
- It executes the code fragments at given time (keyframes)
- It can play the events from start or from a defined position (index)
- It can be interrupted from outside
- user defined code can be executed onInterrupt or onFinished
Parameters
Parameter | Description |
---|---|
timeline | 2D ARRAY: array with keyframes and code to be activated at a certain time |
pointer | NUMBER: where to start playing (index) |
music | (OPTIONAL) - STRING: music to be played which will provide the sync time for the timeline |
codeInterrupt | (OPTIONAL) - CODE: code to be executed if the timeline is interrupted (missionNamespace setVariable ["BIS_fnc_eventTimeline_play", FALSE]) |
codeStop | (OPTIONAL) - CODE or ARRAY: code or array of codes to be executed once the timeline is finshed. The codes are CALLed one after the other. |
BIS_fnc_animatedScreen
- Handles pictures, texts, layers, animations
- Provides ways to create, destroy, reset all layers
- Can animate pictures and texts in several ways (scaling, moving, rotating, etc...)
- Operates in different ways depending on which parameters are passed
Init mode
Parameter | Description |
---|---|
mode = "MODE_INIT" | Mode used for initializing the framework |
layers |
(opt) NUMBER or ARRAY:
|
overscale | |
contentRatio |
Reset mode
Parameter | Description |
---|---|
mode = "MODE_RESET" | Mode used for clearing all the initialized layers (all pictures and texts are removed but layers will still exist) |
flags |
ARRAY: array of 3 BOOL values for picture layers, text layers and overlay layers. If true, deletes the controls in these layers.
|
Layer Create mode
Parameter | Description |
---|---|
mode = "MODE_LAYER_CREATE" | Mode used for creating layers containing pictures |
layer | NUMBER: ID of the layer |
texture | STRING: Path to the picture to be displayed |
posCenter | (opt) ARRAY: Center position of the picture in x,y coordinates |
alpha | (opt) NUMBER: Alpha of the picture (1 = fully visible) |
scale | (opt) NUMBER: Scale of the picture (1 = original size) |
Layer Animate mode
Parameter | Description |
---|---|
mode = "MODE_LAYER_ANIMATE" | Mode used for animating layers containing pictures |
layer | NUMBER: ID of the layer |
duration | (opt) NUMBER: Duration of the animation |
posCenterEnd | (opt) ARRAY: Final position of the picture's center in x,y coordinates |
scaleEnd | (opt) NUMBER: Final scale amount of the picture |
posCenterStart | (opt) ARRAY: Initial position of the picture's center in x,y coordinates |
scaleStart | (opt) NUMBER: Initial scale amount of the picture |
Layer Rotate mode
Parameter | Description |
---|---|
mode = "MODE_LAYER_ROTATE" | Mode used for rotating layers |
layer | NUMBER: ID of the layer |
duration | NUMBER: Duration of the animation |
angleDelta | NUMBER: Desired amount of rotation |
angleStart | (opt) NUMBER: Initial rotation amount |
Layer Fade mode
Parameter | Description |
---|---|
mode = "MODE_LAYER_FADE" | Mode used for layers |
layer | NUMBER: ID of the layer |
duration | NUMBER: Duration of the animation |
alphaEnd | (opt) NUMBER: Final alpha of the layer |
alphaStart | (opt) NUMBER: Initial alpha of the layer |
Layer Pulse mode
Parameter | Description |
---|---|
mode = "MODE_LAYER_PULSE" | Mode used for fading from and to different alpha values in a cyclic manner |
layer | NUMBER: ID of the layer |
duration | NUMBER: Duration of the animation |
alpha1 | (opt) NUMBER: First alpha value |
alpha2 | (opt) NUMBER: Second alpha value |
cycles | (opt) NUMBER: Number of cycles/times the animation will happen (a full cycle consists of the layer fading to alpha1 and then to alpha2) |
Text Create mode
Parameter | Description |
---|---|
mode = "MODE_TEXT_CREATE" | Mode used for creating layers containing text |
layer | NUMBER: ID of the layer |
text | (opt) STRING: Text content |
position | (opt) ARRAY: Text position in x,y coordinates |
align | (opt) NUMBER: Text alignment. Options are: ALIGN_TOPLEFT, ALIGN_BOTTOMLEFT, ALIGN_LEFT, ALIGN_TOP, ALIGN_CENTER, ALIGN_BOTTOM, ALIGN_TOPRIGHT, ALIGN_RIGHT, ALIGN_BOTTOMRIGHT |
color | (opt) ARRAY: Color of the text in r,g,b,a format |
alpha | (opt) NUMBER: Alpha of the text |
tagSize | (opt) NUMBER: Size of the text |
tagShadow | (opt) NUMBER: Shadow style |
tagFont | (opt) STRING: Text font |
Text Animate mode
Parameter | Description |
---|---|
mode = "MODE_TEXT_ANIMATE" | Mode used for animating layers containing text |
layer | NUMBER: ID of the layer |
duration | (opt) NUMBER: Duration of the animation |
posEnd | (opt) ARRAY: Final position of the text in x,y coordinates |
scaleEnd | (opt) NUMBER: Final text scale |
alphaEnd | (opt) NUMBER: Final text alpha |
posStart | (opt) ARRAY: Initial position of the text in x,y coordinates |
scaleStart | (opt) NUMBER: Initial text scale |
alphaStart | (opt) NUMBER: Initial text alpha |
Create Overlay mode
Parameter | Description |
---|---|
mode = "MODE_OVERLAY_CREATE" | Mode used for creating layers for overlays |
layer | NUMBER: ID of the layer |
text | (opt) STRING: Text content |
position | (opt) ARRAY: Position in x,y coordinates |
align | (opt) NUMBER: Text alignment. Options are: ALIGN_TOPLEFT, ALIGN_BOTTOMLEFT, ALIGN_LEFT, ALIGN_TOP, ALIGN_CENTER, ALIGN_BOTTOM, ALIGN_TOPRIGHT, ALIGN_RIGHT, ALIGN_BOTTOMRIGHT |
color | (opt) ARRAY: Color of the text in r,g,b,a format |
alpha | (opt) NUMBER: Alpha of the text |
tagSize | (opt) NUMBER: Size of the text |
tagShadow | (opt) NUMBER: Shadow style |
tagFont | (opt) STRING: Text font |
Create Skybox mode
Parameter | Description |
---|---|
mode = "MODE_SKYBOX_CREATE" | |
layer | NUMBER: ID of the layer |
texture | STRING: Path to the picture to be displayed |
alpha | (opt) NUMBER: Alpha of the picture (1 = fully visible) |
duration |
Destroy mode
Parameter | Description |
---|---|
mode = "MODE_DESTROY" | Mode used for terminating animations and destroying all layers |
BlackOut mode
Parameter | Description |
---|---|
mode = "MODE_BLACKOUT" | Mode used for fading out the screen to black |
duration | (opt) NUMBER: Duration of the fade out time |
wait | (opt) BOOL: If true, script sleeps until the fading is complete |
BlackIn mode
Parameter | Description |
---|---|
mode = "MODE_BLACKIN" | Mode used for fading in the screen from black |
duration | (opt) NUMBER: Duration of the fade in time |
wait | (opt) BOOL: If true, script sleeps until the fading is complete |
Setup and Usage
A Timeline needs to be prepared before calling the Animated Opening function.
Timeline
- A timeline is a multi-dimensional array in which each element consists of a time (represented by a number) and an event (a piece of code).
- The timeline starts counting from 0 when it is created.
- When the time specified in a timeline's element has elapsed, its relative event is spawned.
- The timeline stops once it reaches the last element. The last element's code can also be empty if you're just using the element as an ending point.
- The timeline can be kept in a separate file and included using #include "timelineFile.sqf"; within the file calling the animated opening.
private _timeline = [ [ 0, { [MODE_RESET,[true,true]] call bis_fnc_animatedScreen; [MODE_BLACKIN,0,false] call bis_fnc_animatedScreen; } ], [ 1.5, { [MODE_BLACKOUT,3,false] call bis_fnc_animatedScreen; } ], [ 8.2, { [MODE_RESET,[true,true]] call bis_fnc_animatedScreen; [MODE_BLACKOUT, 0.01, true] call bis_fnc_animatedScreen; [MODE_LAYER_CREATE, C03_SLIDE1_ID_DUST, C03_SLIDE1_IMG_DUST, nil, nil, 1.3 ] call bis_fnc_animatedScreen; [MODE_LAYER_CREATE, C03_SLIDE1_ID_OBSTACLE, C03_SLIDE1_IMG_OBSTACLE, [0.46,0.45], nil, 1.2 ] call bis_fnc_animatedScreen; } ], [ 12, {} ] ];