Disable and enable node when opening mouth

I’m trying to make a filter that detects some expressions and disappears them based on the emotion or trigger. Could you help if the concept is wrong or if there is another better way to do it?


this is my code to detect if the mouth is open or not

// Use this for initialization
function onStart() {}

// Update is called once per frame
function onUpdate() {}

function onTriggerStateChanged(triggerType, state, faceId) {
  if (Utility.TriggerType.MOUTH_OPEN_SENSITIVE === triggerType) {
    Utility.changeParameter("Node_3", "", "enabled", false);
    Debug.log("open");
    return;
  }
  if (Utility.TriggerType.MOUTH_CLOSED_SENSITIVE === triggerType) {
    Utility.changeParameter("Node_3", "", "enabled", true);
    Debug.log("close");
    return;
  }
}

However, when opening the mouth, 2 events happen quickly, but nothing happens in the node.

image

Can anyone help or suggest another concept?

This is the evolution of my code, it seems to be working, but how can I add more states like sad?

// Use this for initialization

var mouthClose;
var mouthOpen;

function onStart() {
  mouthClose = Node.root.getChild("mouthClose");
  mouthOpen = Node.root.getChild("mouthOpen");
}

// Update is called once per frame
function onUpdate() {}

function onTriggerStateChanged(triggerType, state, faceId) {
  if (Utility.TriggerType.SMILE == triggerType) {
    mouthClose.enabled = state;
    mouthOpen.enabled = !state;
    // Debug.log("open");
  }
}