<!--
{
  "availability" : [
    "iOS: 8.0.0 - 26.0.0",
    "iPadOS: 8.0.0 - 26.0.0",
    "macCatalyst: 13.1.0 - 26.0.0",
    "macOS: 10.8.0 - 26.0.0",
    "tvOS: 9.0.0 - 26.0.0",
    "visionOS: 1.0.0 - 26.0.0",
    "watchOS: 3.0.0 - 26.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "SceneKit",
  "identifier" : "/documentation/SceneKit/SCNExportJavaScriptModule(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "SceneKit"
    ],
    "preciseIdentifier" : "c:@F@SCNExportJavaScriptModule"
  },
  "title" : "SCNExportJavaScriptModule(_:)"
}
-->

# SCNExportJavaScriptModule(_:)

Makes SceneKit classes and global constants available to the specified JavaScript context.

```
func SCNExportJavaScriptModule(_ context: JSContext)
```

## Discussion

By controlling SceneKit using JavaScript code supplied at run time, you can enable rapid development for parts of your game or app. For example, a designer can easily experiment with visual effects or game-character behaviors without needing to compile and deploy your complete Xcode project.

This function exports all SceneKit classes and global constants, and all methods and properties on those classes, to JavaScript using the rules defined in the <doc://com.apple.documentation/documentation/JavaScriptCore/JSExport> protocol. For example, the JavaScript code below performs various operations on a SceneKit node:

```javascript
var aNode = SCNNode.node();
aNode.opacity = 0.5;
aNode.removeFromParentNode();
// Animate an opacity change.
SCNTransaction.begin();
SCNTransaction.setAnimationDuration(1.0);
aNode.opacity = 0.5;
SCNTransaction.commit();
```

For SceneKit APIs that involve vectors and matrices, use JavaScript object syntax to define those values in terms of their elements:

```javascript
aNode.scale = {x:2, y:2, z:2};
aNode.transform = {m11:1, m12:0, m13:0, /*...*/ m44:1};
```

SceneKit also exports the following special JavaScript objects and functions:

|Objective-C / Swift class                                                                                                 |JavaScript constructor                           |
|--------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------|
|<doc://com.apple.documentation/documentation/AppKit/NSColor> / <doc://com.apple.documentation/documentation/UIKit/UIColor>|`SCNColor.color(r,g,b,a)`                        |
|<doc://com.apple.documentation/documentation/AppKit/NSImage> / <doc://com.apple.documentation/documentation/UIKit/UIImage>|`SCNImage.imageWithURL(aURL)`                    |
|                                                                                                                          |`SCNImage.imageWithPath(aPath)`                  |
|<doc://com.apple.documentation/documentation/QuartzCore/CABasicAnimation>                                                 |`CABasicAnimation.animationWithKeyPath(aPath)`   |
|<doc://com.apple.documentation/documentation/QuartzCore/CAKeyframeAnimation>                                              |`CAKeyframeAnimation.animationWithKeyPath(aPath)`|
|<doc://com.apple.documentation/documentation/QuartzCore/CAAnimationGroup>                                                 |`new CAAnimationGroup()`                         |
|<doc://com.apple.documentation/documentation/QuartzCore/CAMediaTimingFunction>                                            |`CAMediaTimingFunction.functionWithName(name)`   |

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)