In this sample, you may use the loadActor function to show and hide the
current actors at certain times by pressing buttons with specific behaviors.
Your viewers may then hide the actor if they want to see more of the background
without being convered by the actor. Furthermore, the playback or the idle motions
continue even though the actor is hidden.
Using the loadActor Function
This sample contains 2 buttons, their behaviors are:
Click the first button, Show Actor, to fade the actor in, in one
Click the second button, Hide Actor, to fade the actor out, in
Copy and paste the codes in-between the <head> and
tags of your custom web page.
The purposes of the functions:
This function defines the address, the position of
the CrazyTalk Web Player in the custom web
and loads and plays a default project (Actor_showhide.uctproject)
in which the actor applied with an idle motion (CTDefWebPreview.uctidle) once
your page is opened.
functionShow(): This function
shows the actor in one second.
functionHide(): This function
hides the actor in two seconds.
The adjustable codes in the functions: $(function ()
Replace the below address of the CrazyTalk Web Player with the one within your self-hosting
For more information about the modification method to the
function loading a default project, please refer to the
Sample Code 3 - Loading Projects section.
player.showActor( true, 1.0):
This Boolean (true for false)
value determines if the character will be shown or hidden when the project is loaded.
The number: The number is the duration time (in seconds) for fading in or fading out the