shsunmoonlee / SparkAR-HotAir

0 stars 0 forks source link

0.1 Patrick #4

Open patrickscheper opened 6 years ago

patrickscheper commented 6 years ago

var Textures = require('Textures'); var Materials = require('Materials');

var FacialExpressions = { leftBlink : 0, rightBlink : 1, shake : 2, openMouth : 3, raisedBrows : 4 } var clientExpressionsArray = new Array();

clientExpressionsArray.push(1);

clientExpressionsArray.push(4);

ClearSprites(); SetSpritesFromArray();

function SetSpritesFromArray() { var i = 0; clientExpressionsArray.forEach(element => {

switch(element){

    case FacialExpressions.leftBlink:
    SetSpriteToMaterial(i, "181019_Emojis_WinkLeft");

// Patches.setPulseValue("ShowLeftBlink", Reactive.once()); break; case FacialExpressions.rightBlink: SetSpriteToMaterial(i, "181019_Emojis_WinkRight"); // Patches.setPulseValue("ShowRightBlink", Reactive.once()); break; case FacialExpressions.shake: SetSpriteToMaterial(i, "181019_Emojis_ShakeNewer"); // Patches.setPulseValue("ShowShake", Reactive.once()); break; case FacialExpressions.openMouth: SetSpriteToMaterial(i, "181019_Emojis_Woooow"); // Patches.setPulseValue("ShowOpenMouth", Reactive.once()); break; case FacialExpressions.raisedBrows: SetSpriteToMaterial(i, "181019_Emojis-RaiseBrows"); break;

default:
SetSpriteToMaterial(i, "Zero");
break; 

}

i++;

}); }

function SetSpriteToMaterial(i, y){

switch(i){

    case 0:

Materials.get("ExpressionOne").diffuse = Textures.get(y);

    break;
case 1:
Materials.get("ExpressionTwo").diffuse = Textures.get(y);
break;
    case 2:
    Materials.get("ExpressionThree").diffuse = Textures.get(y);
    break;
    case 3:
    Materials.get("ExpressionFour").diffuse = Textures.get(y);
    break;
    case 4:
    Materials.get("ExpressionFive").diffuse = Textures.get(y);
    break;
default:

}

};

function ClearSprites() {

    Materials.get("ExpressionOne").diffuse = Textures.get("OnePixel");
    Materials.get("ExpressionTwo").diffuse = Textures.get("OnePixel");
    Materials.get("ExpressionThree").diffuse = Textures.get("OnePixel");
    Materials.get("ExpressionFour").diffuse = Textures.get("OnePixel");
    Materials.get("ExpressionFive").diffuse = Textures.get("OnePixel");

};