Friday, November 25, 2022
HomeGame DevelopmentFind out how to create a sprite recreation object with the base64...

Find out how to create a sprite recreation object with the base64 URL as sprite body? – Cocos Creator


Hiya, I’m attempting to construct a recreation for the Fb platform and attempting to create a profile image sprite with the Fb person picture base64 URL, however couldn’t obtain this. please assistance on the identical.

thanks

 assetManager.loadRemote(FBInstant.participant.getPhoto(), {ext : ".jfif"}, (err : any, picture : SpriteFrame) => {

            PlayerDataCache.Occasion.avatarFrame = picture;
 })


let img = new Picture();
img.src = srcurl;
img.onload =operate(res){
.....
}

Thanks @Koei this additionally works and in cocos there’s option to deal with like beneath.

`

remoteUrl = "http://unknown.org/emoji?id=124982374";
assetManager.loadRemote<ImageAsset>(remoteUrl, {ext: '.png'}, operate (err, imageAsset) {
    const spriteFrame = new SpriteFrame();
    const texture = new Texture2D();
    texture.picture = imageAsset;
    spriteFrame.texture = texture;
    // ...
});

`
distant URL is your base64 string URL deal with. be sure to are including {ext : ".png") in choices.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments