This quick start tutorial is designed to walk you through the Scaleform Studio Editor as we demonstrate how to to create a simple animated UI scene for the basic template project provided in Stingray.
Launch Scaleform Studio using Autodesk Games Launcher.
You can also launch Scaleform Studio from Stingray (Window > Scaleform Studio). If using this method, make sure to save your Scaleform Studio project to a new location outside of the Stingray project folder.
Import assets such as bitmaps or vector graphics into Scaleform Studio using the Assets panel, then save the project.
Drag the image asset from the Assets panel and place it on the viewport. By default, the object is placed in Scene 0. This creates an Actor with a bitmap component on the viewport.
You can also drag images from a directory to the viewport. The Assets panel automatically populates the images.
With the timeline controls, try the following:
Place the scrubber at the desired playhead position, right-click and select Insert Frames or click the Insert Frame icon . You can also use press A to insert a new frame.
Right-click and select Insert KeyFrames or press the Insert Key frame icon to insert a key frame.
Select the Actor and make a change (for example, change its position, set an animation tween using the frame controls in the Timeline panel, or make it appear brighter, or tinted).
To view the transformations set, drag the red scrubber from one key frame to another.
As an example, try the following:
On frame 15, click Add Tween icon , set the tweening function to 'Linear' and select one of the easing type.
Now, if you move the timeline playhead from frame 1 to frame 30, you get a smooth translation interpolation.
Select frame 30, and in Frame panel enter a frame command Stop to tell the animation to stop playing when it reaches frame 30. (This step is optional. Looping is the default behavior.)
You can also press Ctrl + Return to launch the Scaleform Studio Player and see the animation playing.
Note: You can enable the editor to remotely control the player using the Player > Player Option. This lets you play the project without saving and all messages are sent to the Logs panel.
Select your image Actor.
Notice that you can navigate the scene hierarchy using the breadcrumb labels at the upper left of the viewport.
You can add scripts and event handlers to assets and edit them using the Scripts panel.
Add the following sample Lua code in the Scripts panel. This script toggles the Actor's transparency when the mouse is over it.
--This script is executed on object creation local thisActor = ... --Create mouse over Event Handler local mouseListener = scaleform.EventListener.create(function(e) --Toggle alpha on mouse over if e.EventId == MouseOver then scaleform.Actor.set_alpha_scale(thisActor, .5); end end); local mouseOutListener = scaleform.EventListener.create(function(e) if e.EventId == MouseOut then scaleform.Actor.set_alpha_scale(thisActor, 1.0); end end ); -- Add MouseOver/MouseOut event handler scaleform.Actor.add_event_listener(thisActor, scaleform.EventTypes.MouseOver, mouseListener); scaleform.Actor.add_event_listener(thisActor, scaleform.EventTypes.MouseOut, mouseOutListener);
Save and run the project to see the result.
You can add text to the scene using the Text tool provided in the Tool bar on the left of the Scaleform Studio Editor.
Try the following:
Save your project.
Use the Widgets panel to add and customize prebuilt user interface elements such as buttons, text input, sliders in your project.
The Widgets panel provides a set of readymade, commonly used UI controls (widgets) that work out of the box. These controls can be customized by the user to match the look and operation required by their application.
Here is an example of how to use the Widgets panel.
Try the following:
Drag and place the button on the viewport.
Double-click the button on the viewport to view its timeline layers.
On the timeline, you’ll find the button implemented as two layers, one for the label and other for background. The button has four states, normal, over, press and disabled set on the timeline.
Select the background layer on the timeline to add effects to change the background of the button on any of its state change.
Try the following:
On frame 1, set Effects Style to None for the text and change the font color by selecting a different color from the Color field. Repeat this for the other states to change the font color.
Select the background layer, place the scrubber on frame 1, and click the Open Folder icon in the Bitmap component section to select a different image as the background of the button. Adjust the size of the background image to the size of the button using the Size field in the Transform section.
Move to frame 11, which is the hover state and select a different color and tint in the Effects section of the properties panel. The button will display the new colors from frame 11 to 20 and will have the default color for rest of the states.
Save and run the project to view the button in the player. The background of the button changes when you hover over the button and when the button is pressed, a print message is displayed in the console window next to the player if you are using a stand alone player. If the player is controlled by the editor, the output is displayed in the Logs panel.
Or use the Widgets Panel to select the Button widget and give a different name in the Name field, add desired size and then double-click to create a new button at position(0,0) on the viewport. You can also drag and drop the button to a desired position on the viewport.
This adds the Scaleform Studio project under a folder named s2d_projects in Stingray.
By default, the basic template provides a basic front end menu. To display your Scaleform Studio UI content instead, you’ll edit a Lua script file.
Click the Save icon in the Script Editor to save the main_menu file.
Load the main_menu level (Ctrl+O or File >Open Level).
Test the project by clicking the Play button in the Level Viewport toolbar.
To edit your Scaleform Studio content again, navigate to the .s2dproj file under s2d_projects in the Stingray Asset Browser and double-click it to launch it in the Scaleform Studio Editor.