BitmojiModule
ClassProvides access to functionalities related to Bitmoji avatar.
- Available on all platforms
Since Lens Scripting v173
Index
Properties
Methods
Example
// @input Asset.BitmojiModule bitmojiModule
// @input Asset.RemoteMediaModule remoteMediaModule
// @input Asset.Material pbrMaterialHolder
script.bitmojiModule.requestBitmoji3DResource(
function (bitmoji3DResource) {
script.remoteMediaModule.loadResourceAsGltfAsset(
bitmoji3DResource,
onDownloaded,
onFail
)
}
)
function onDownloaded (gltfAsset){
var root = scene.createSceneObject("BitmojiAvatar");
var gltfSettings = GltfSettings.create();
gltfSettings.convertMetersToCentimeters = true;
var avatar = gltfAsset.tryInstantiateWithSetting(root, script.pbrMaterialHolder, gltfSettings);
}
function onFail (e){
print(e);
}
Extends
Properties
name
name:
string
The name of the Asset in Lens Studio.
Default Value
""
Inherited from
uniqueIdentifier
readonlyuniqueIdentifier:string
Since
Lens Scripting Version 176
Inherited from
Methods
createMockUser()
createMockUser(
seed):SafeUser
Creates a mock user with a deterministic Bitmoji avatar.
The returned user can be set on Bitmoji3DOptions.user or Bitmoji2DOptions.user to load a Bitmoji
without requiring a real Snapchat user.
The same seed value always produces the same avatar within a given lens,
while different seeds produce different avatars.
Parameters
| Parameter | Type | Description |
|---|---|---|
seed | string | A non-empty string used to deterministically select the avatar. |
Returns
Since
Lens Scripting Version 353
getTypeName()
staticgetTypeName():TypeName<BitmojiModule>
Returns the fully-qualified JavaScript type name for this class (for example, "Component.Camera"). This is a static accessor (no instance required) and returns the same value as the instance getTypeName().
Returns
TypeName<BitmojiModule>
Since
Lens Scripting Version 173
Overrides
getTypeName()
getTypeName():
string
Returns the name of this object's type.
Returns
string
Inherited from
isOfType()
isOfType(
type):boolean
Returns true if the object matches or derives from the passed in type.
Parameters
| Parameter | Type |
|---|---|
type | string |
Returns
boolean
Inherited from
isSame()
isSame(
other):boolean
Returns true if this object is the same as other. Useful for checking if two references point to the same thing.
Parameters
| Parameter | Type |
|---|---|
other | ScriptObject |
Returns
boolean
Inherited from
requestBaseBitmoji3DResourceWithOptions()
requestBaseBitmoji3DResourceWithOptions(
options,baseBodyParams,callback):void
Request a base Bitmoji3D resource with explicit body customization options.
Uses the default base avatar and applies body parameters from baseBodyParams if provided.
If baseBodyParams is not provided or missing values, falls back to cached avatar data.
Parameters
| Parameter | Type |
|---|---|
options | Bitmoji3DOptions |
baseBodyParams | BaseBodyParams |
callback | (resource) => void |
Returns
void
Since
Lens Scripting Version 345
requestBitmoji2DResource()
requestBitmoji2DResource(
options,callback):void
Returns a DynamicResource via the provided callback, which can be resolved into a texture using RemoteMediaModule.
Parameters
| Parameter | Type |
|---|---|
options | Bitmoji2DOptions |
callback | (resource) => void |
Returns
void
Since
Lens Scripting Version 256
requestBitmoji3DResource()
requestBitmoji3DResource(
callback):void
Request the current user's 3D Bitmoji avatar.
Parameters
| Parameter | Type |
|---|---|
callback | (resource) => void |
Returns
void
Since
Lens Scripting Version 173
requestBitmoji3DResourceWithOptions()
requestBitmoji3DResourceWithOptions(
options,callback):void
Request the Bitmoji3D resource.
Parameters
| Parameter | Type |
|---|---|
options | Bitmoji3DOptions |
callback | (resource) => void |
Returns
void
Since
Lens Scripting Version 256
See also
Bitmoji Overview guide.