Skip to content

Instantly share code, notes, and snippets.

@bnjm
Last active August 21, 2018 11:28
Show Gist options
  • Save bnjm/019518cee6cbcbcb14d03dc13a16824e to your computer and use it in GitHub Desktop.
Save bnjm/019518cee6cbcbcb14d03dc13a16824e to your computer and use it in GitHub Desktop.
import React, { Component } from 'react'
import { Platform, StyleSheet, Text, View } from 'react-native'
import { ARKit } from 'react-native-arkit'
export default class App extends Component<Props> {
render() {
return (
<View style={{ flex: 1 }}>
<ARKit
style={{ flex: 1 }}
planeDetection={ARKit.ARPlaneDetection.Horizontal}
lightEstimationEnabled
>
<ARKit.Group position={{ x: 0, y: 0, z: -0.5 }} scale={0.1}>
<ARKit.Model
model={{ file: 'art.scnassets/eames/model.dae' }}
position={{ x: 0, y: -2.0, z: -3.0 }}
eulerAngles={{ x: 0, y: Math.PI * 2.0, z: 0 }}
/>
<ARKit.Box
position={{ x: 0, y: 0.4, z: 0.0 }}
material={{
diffuse: { path: 'Brick.diffuse' },
}}
shape={{
width: 0.3,
length: 0.3,
height: 0.3,
chamfer: 0.02,
}}
transition={{ duration: 1 }}
/>
</ARKit.Group>
<ARKit.Light
position={{ x: 1, y: 3, z: 2 }}
type={ARKit.LightType.Omni}
color="white"
/>
<ARKit.Light
position={{ x: 0, y: 5, z: 0 }}
type={ARKit.LightType.Spot}
eulerAngles={{ x: -Math.PI / 2 }}
spotInnerAngle={45}
spotOuterAngle={45}
color="rgba(255, 240, 240, 1)"
/>
</ARKit>
</View>
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment