Created
October 16, 2018 15:00
-
-
Save SunXiaoShan/13bab646bb5396ffed14a7364cd56a90 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func updateFeatures(for node: SCNNode, using anchor: ARFaceAnchor) { | |
| for (feature, indices) in zip(features, featureIndices) { | |
| let child = node.childNode(withName: feature, recursively: false) as? EmojiNode | |
| let vertices = indices.map { anchor.geometry.vertices[$0] } | |
| child?.updatePosition(for: vertices) | |
| switch feature { | |
| case "leftEye": | |
| let scaleX = child?.scale.x ?? 1.0 | |
| let eyeBlinkValue = anchor.blendShapes[.eyeBlinkLeft]?.floatValue ?? 0.0 | |
| child?.scale = SCNVector3(scaleX, 1.0 - eyeBlinkValue, 1.0) | |
| let eyeLookDL = anchor.blendShapes[.eyeLookDownLeft]?.floatValue ?? 0.0 | |
| if (eyeLookDL > 0.4) { | |
| let messageVC = UIAlertController(title: "eye look down left", message: "Account Created successfully" , preferredStyle: .actionSheet) | |
| present(messageVC, animated: true) { | |
| Timer.scheduledTimer(withTimeInterval: 0.5, repeats: false, block: { (_) in | |
| messageVC.dismiss(animated: true, completion: nil)})} | |
| } | |
| default: | |
| break | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment