{"_id":"59bc03d31d2d8d001a34458e","category":{"_id":"59bc03d31d2d8d001a344583","version":"59bc03d31d2d8d001a34457d","project":"578c4badbd223d2000cc1441","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-08-01T23:04:12.838Z","from_sync":false,"order":6,"slug":"api-reference","title":"API Reference"},"project":"578c4badbd223d2000cc1441","parentDoc":null,"user":"57bb7defafc18c0e00529cf1","version":{"_id":"59bc03d31d2d8d001a34457d","project":"578c4badbd223d2000cc1441","__v":2,"createdAt":"2017-09-15T16:46:11.721Z","releaseDate":"2017-09-15T16:46:11.721Z","categories":["59bc03d31d2d8d001a34457e","59bc03d31d2d8d001a34457f","59bc03d31d2d8d001a344580","59bc03d31d2d8d001a344581","59bc03d31d2d8d001a344582","59bc03d31d2d8d001a344583","59bc284b7c3f420010f965e6"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"2.0.0","version":"2.0.0"},"__v":0,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-10-18T04:02:52.521Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"settings":"","results":{"codes":[]},"auth":"required","params":[],"url":""},"isReference":false,"order":15,"body":"A light object that emits a directional light, much like the sun. See our [Lighting and Material Guide](http://viro.readme.io/docs/3d-scene-lighting) for more information on lights in a scene.\n\n######Example use:\n```\n  {/* A directional light coming from directly above */}\n<ViroDirectionalLight\n    color=\"#ffffff\"\n    direction={[0, -1, 0]}\n />\n```\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Props\"\n}\n[/block]\n##Required Props\n[block:parameters]\n{\n  \"data\": {\n    \"0-0\": \"**direction**\",\n    \"0-1\": \"**PropTypes.arrayOf(PropTypes.number)**\\n\\nA 3D unit vector, specified as [x, y, z] that represents the direction the light is facing. Values for each axis can be from -1 to 1. \\n\\nExample:\\n```\\ndirection={[1, 0, 0]}\\n```\\nThe above would make the light direction be towards positive x. So if an object was positioned at [0,0,0] the light would hit it from it's left side.\"\n  },\n  \"cols\": 2,\n  \"rows\": 1\n}\n[/block]\n##Optional Props\n[block:parameters]\n{\n  \"data\": {\n    \"0-0\": \"**castsShadow**\",\n    \"11-0\": \"**rotation**\",\n    \"12-0\": \"**style**\",\n    \"13-0\": \"**text**\",\n    \"14-0\": \"**transformBehaviors**\",\n    \"16-0\": \"**visible**\",\n    \"15-0\": \"**width**\",\n    \"h-0\": \"PropKey\",\n    \"h-1\": \"PropType\",\n    \"0-1\": \"**PropTypes.bool**\\n\\nTrue if this light should cast shadows.\",\n    \"11-1\": \"PropTypes.arrayOf(PropTypes.number)\\n\\nPut the PropType Description here.\",\n    \"12-1\": \"stylePropType\",\n    \"13-1\": \"PropTypes.string\\n\\nPut the PropType Description here.\",\n    \"14-1\": \"PropTypes.arrayOf(PropTypes.string)\\n\\nPut the PropType Description here.\",\n    \"15-1\": \"PropTypes.number\\n\\nPut the PropType Description here.\",\n    \"16-1\": \"PropTypes.bool\\n\\nPut the PropType Description here.\",\n    \"2-0\": \"**influenceBitMask**\",\n    \"2-1\": \"**PropTypes.number**\\n\\nThis property is used to make lights apply to specific nodes. Lights and nodes in the scene can be assigned bit-masks to determine how each light influences each node. \\n\\nDuring rendering, Viro compares each light's influenceBitMask with each node's lightReceivingBitMask and shadowCastingBitMask. The bit-masks are compared using a bitwise AND operation:\\n\\nIf ```(influenceBitMask & lightReceivingBitMask) != 0```, then the light will illuminate the node (and the node will receive shadows cast from objects occluding the light).\\n\\nIf ```(influenceBitMask & shadowCastingBitMask) != 0```, then the node will cast shadows from the light.\\n\\nThe default mask is 0x1.\",\n    \"3-0\": \"**intensity**\",\n    \"1-0\": \"**color**\",\n    \"1-1\": \"**ColorPropType**\\n\\nThe color of the light. The default light color is white.\\n\\nValid color formats are:\\n\\n  * '#f0f' (#rgb)\\n  * '#f0fc' (#rgba)\\n  * '#ff00ff' (#rrggbb)\\n  * '#ff00ff00' (#rrggbbaa)\\n  * 'rgb(255, 255, 255)'\\n  * 'rgba(255, 255, 255, 1.0)'\\n  * 'hsl(360, 100%, 100%)'\\n  * 'hsla(360, 100%, 100%, 1.0)'\\n  * 'transparent'\\n  * 'red'\\n  * 0xff00ff00 (0xrrggbbaa)\",\n    \"8-0\": \"**shadowOrthographicPosition**\",\n    \"10-0\": \"**shadowOpacity**\",\n    \"9-0\": \"**shadowMapSize**\",\n    \"6-0\": \"**shadowNearZ**\",\n    \"4-0\": \"**shadowBias**\",\n    \"7-0\": \"**shadowOrthographicSize**\",\n    \"5-0\": \"**shadowFarZ**\",\n    \"3-1\": \"**PropTypes.number**\\n\\nThe total brightness of the light. Ranges from 0 to 1000. This value, divided by 1000, serves as a multiplier to the color of the light. \\n\\nThe default intensity is 1000.\",\n    \"4-1\": \"**PropTypes.number**\\n\\nThe amount of bias to apply to the Z coordinate when performing the shadow depth comparison. This reduces shadow acne, but large biases can cause \\\"peter panning\\\".\\n\\nThe default value is 0.005.\",\n    \"5-1\": \"**PropTypes.number**\\n\\nThe far clipping plane to use when rendering shadows. Shadows are only cast by and on surfaces closer than this plane.\\n\\nThis value defines the units away the far clipping plane is from the shadowOrthographicPosition in the direction of the light.\\n\\nThe shadow bounds constructed from this property, shadowNearZ, and shadowOrthographicSize should be kept as tight as possible to maximize the resolution of shadows.\\n\\nThe default value is 20.\",\n    \"6-1\": \"**PropTypes.number**\\n\\nThe near clipping plane to use when rendering shadows. Shadows are only cast by and on surfaces further away than this plane.\\n\\nThis value defines the units away the near clipping plane is from the shadowOrthographicPosition in the direction of the light.\\n\\nThe shadow bounds constructed from this property, shadowFarZ, and shadowOrthographicSize should be kept as tight as possible to maximize the resolution of shadows.\\n\\nThe default value is 0.1.\",\n    \"7-1\": \"**PropTypes.number**\\n\\nThe orthographic size determines the width and height of the area, centered at shadowOrthographicPosition, that should be rendered to the shadow map.\\n     \\nA larger value means more of the scene will be shadowed, but at lower resolution.\\n\\nThe shadow bounds constructed from this property, shadowFarZ, and shadowOrthographicSize should be kept as tight as possible to maximize the resolution of shadows.\\n\\nThe default value is 20.\",\n    \"8-1\": \"**PropTypes.arrayOf(PropTypes.number)**\\n\\nThe center of the shadow map created by this directional light. Although directional lights have no center, the shadow *map* must have a center.\",\n    \"9-1\": \"**PropTypes.number**\\n\\nThe size of the shadow map used to cast shadows for this light.\\n\\nShadows are created by rendering the silhouettes of scene geometry onto a 2D image from the point of view of the light, then projecting that image onto the final view. \\n\\nLarger shadow maps result in higher resolution shadows, but can have a higher memory and performance cost. Smaller shadow maps are faster but result in pixelated edges.\\n\\nThe default value is 1024.\",\n    \"10-1\": \"**PropTypes.number**\\n\\nThe opacity of the shadow. 1.0 creates a pitch black shadow.\"\n  },\n  \"cols\": 2,\n  \"rows\": 11\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"Methods\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"setNativeProps(nativeProps: object)\",\n    \"0-0\": \"A wrapper function around the native component's setNativeProps which allow users to set values on the native component without changing state/setting props and re-rendering. Refer to the React Native documentation on [Direct Manipulation](https://facebook.github.io/react-native/docs/direct-manipulation.html) for more information.\\n\\n|Parameter|Description|\\n|---|---|\\n|nativeProps | an object where the keys are the properties to set and the values are the values to set  |\\n\\nFor example, setting position natively would look like this:\\n\\n```\\ncomponentRef.setNativeProps({\\n    position : [0, 0, -1]\\n});\\n```\"\n  },\n  \"cols\": 1,\n  \"rows\": 1\n}\n[/block]","excerpt":"","slug":"virodirectionallight-1","type":"basic","title":"ViroDirectionalLight"}

ViroDirectionalLight


A light object that emits a directional light, much like the sun. See our [Lighting and Material Guide](http://viro.readme.io/docs/3d-scene-lighting) for more information on lights in a scene. ######Example use: ``` {/* A directional light coming from directly above */} <ViroDirectionalLight color="#ffffff" direction={[0, -1, 0]} /> ``` [block:api-header] { "type": "basic", "title": "Props" } [/block] ##Required Props [block:parameters] { "data": { "0-0": "**direction**", "0-1": "**PropTypes.arrayOf(PropTypes.number)**\n\nA 3D unit vector, specified as [x, y, z] that represents the direction the light is facing. Values for each axis can be from -1 to 1. \n\nExample:\n```\ndirection={[1, 0, 0]}\n```\nThe above would make the light direction be towards positive x. So if an object was positioned at [0,0,0] the light would hit it from it's left side." }, "cols": 2, "rows": 1 } [/block] ##Optional Props [block:parameters] { "data": { "0-0": "**castsShadow**", "11-0": "**rotation**", "12-0": "**style**", "13-0": "**text**", "14-0": "**transformBehaviors**", "16-0": "**visible**", "15-0": "**width**", "h-0": "PropKey", "h-1": "PropType", "0-1": "**PropTypes.bool**\n\nTrue if this light should cast shadows.", "11-1": "PropTypes.arrayOf(PropTypes.number)\n\nPut the PropType Description here.", "12-1": "stylePropType", "13-1": "PropTypes.string\n\nPut the PropType Description here.", "14-1": "PropTypes.arrayOf(PropTypes.string)\n\nPut the PropType Description here.", "15-1": "PropTypes.number\n\nPut the PropType Description here.", "16-1": "PropTypes.bool\n\nPut the PropType Description here.", "2-0": "**influenceBitMask**", "2-1": "**PropTypes.number**\n\nThis property is used to make lights apply to specific nodes. Lights and nodes in the scene can be assigned bit-masks to determine how each light influences each node. \n\nDuring rendering, Viro compares each light's influenceBitMask with each node's lightReceivingBitMask and shadowCastingBitMask. The bit-masks are compared using a bitwise AND operation:\n\nIf ```(influenceBitMask & lightReceivingBitMask) != 0```, then the light will illuminate the node (and the node will receive shadows cast from objects occluding the light).\n\nIf ```(influenceBitMask & shadowCastingBitMask) != 0```, then the node will cast shadows from the light.\n\nThe default mask is 0x1.", "3-0": "**intensity**", "1-0": "**color**", "1-1": "**ColorPropType**\n\nThe color of the light. The default light color is white.\n\nValid color formats are:\n\n * '#f0f' (#rgb)\n * '#f0fc' (#rgba)\n * '#ff00ff' (#rrggbb)\n * '#ff00ff00' (#rrggbbaa)\n * 'rgb(255, 255, 255)'\n * 'rgba(255, 255, 255, 1.0)'\n * 'hsl(360, 100%, 100%)'\n * 'hsla(360, 100%, 100%, 1.0)'\n * 'transparent'\n * 'red'\n * 0xff00ff00 (0xrrggbbaa)", "8-0": "**shadowOrthographicPosition**", "10-0": "**shadowOpacity**", "9-0": "**shadowMapSize**", "6-0": "**shadowNearZ**", "4-0": "**shadowBias**", "7-0": "**shadowOrthographicSize**", "5-0": "**shadowFarZ**", "3-1": "**PropTypes.number**\n\nThe total brightness of the light. Ranges from 0 to 1000. This value, divided by 1000, serves as a multiplier to the color of the light. \n\nThe default intensity is 1000.", "4-1": "**PropTypes.number**\n\nThe amount of bias to apply to the Z coordinate when performing the shadow depth comparison. This reduces shadow acne, but large biases can cause \"peter panning\".\n\nThe default value is 0.005.", "5-1": "**PropTypes.number**\n\nThe far clipping plane to use when rendering shadows. Shadows are only cast by and on surfaces closer than this plane.\n\nThis value defines the units away the far clipping plane is from the shadowOrthographicPosition in the direction of the light.\n\nThe shadow bounds constructed from this property, shadowNearZ, and shadowOrthographicSize should be kept as tight as possible to maximize the resolution of shadows.\n\nThe default value is 20.", "6-1": "**PropTypes.number**\n\nThe near clipping plane to use when rendering shadows. Shadows are only cast by and on surfaces further away than this plane.\n\nThis value defines the units away the near clipping plane is from the shadowOrthographicPosition in the direction of the light.\n\nThe shadow bounds constructed from this property, shadowFarZ, and shadowOrthographicSize should be kept as tight as possible to maximize the resolution of shadows.\n\nThe default value is 0.1.", "7-1": "**PropTypes.number**\n\nThe orthographic size determines the width and height of the area, centered at shadowOrthographicPosition, that should be rendered to the shadow map.\n \nA larger value means more of the scene will be shadowed, but at lower resolution.\n\nThe shadow bounds constructed from this property, shadowFarZ, and shadowOrthographicSize should be kept as tight as possible to maximize the resolution of shadows.\n\nThe default value is 20.", "8-1": "**PropTypes.arrayOf(PropTypes.number)**\n\nThe center of the shadow map created by this directional light. Although directional lights have no center, the shadow *map* must have a center.", "9-1": "**PropTypes.number**\n\nThe size of the shadow map used to cast shadows for this light.\n\nShadows are created by rendering the silhouettes of scene geometry onto a 2D image from the point of view of the light, then projecting that image onto the final view. \n\nLarger shadow maps result in higher resolution shadows, but can have a higher memory and performance cost. Smaller shadow maps are faster but result in pixelated edges.\n\nThe default value is 1024.", "10-1": "**PropTypes.number**\n\nThe opacity of the shadow. 1.0 creates a pitch black shadow." }, "cols": 2, "rows": 11 } [/block] [block:api-header] { "title": "Methods" } [/block] [block:parameters] { "data": { "h-0": "setNativeProps(nativeProps: object)", "0-0": "A wrapper function around the native component's setNativeProps which allow users to set values on the native component without changing state/setting props and re-rendering. Refer to the React Native documentation on [Direct Manipulation](https://facebook.github.io/react-native/docs/direct-manipulation.html) for more information.\n\n|Parameter|Description|\n|---|---|\n|nativeProps | an object where the keys are the properties to set and the values are the values to set |\n\nFor example, setting position natively would look like this:\n\n```\ncomponentRef.setNativeProps({\n position : [0, 0, -1]\n});\n```" }, "cols": 1, "rows": 1 } [/block]