[ReactVR] Start a Virtual Reality Project Using the React VR CLI
2024-10-01 10:32:55
We will learn how to set up a React VR project, run the development mode with hot reloading, and take a small dive into the generated code and make a small change.
Install:
npm -g i react-vr-cli
Create app:
react-vr init app
Enable hotreload:
localhost:/vr/?hotreload
import React from 'react';
import {
AppRegistry,
asset,
Pano,
Text,
View,
} from 'react-vr'; export default class app extends React.Component {
render() {
return (
<View>
<Pano
style={{
transform: [{rotateY: "10deg"}]
}}
onLoad={() => {console.log('Image is loaded successfully')}}
onLoadEnd={() => {console.log('Load end')}}
source={asset('mittel.jpg')}
/>
<Text
style={{
backgroundColor: '#777879',
fontSize: 0.8,
fontWeight: '400',
layoutOrigin: [0.5, 0.5],
paddingLeft: 0.2,
paddingRight: 0.2,
textAlign: 'center',
textAlignVertical: 'center',
transform: [{translate: [0, 0, -3]}],
}}>
hello world
</Text>
</View>
);
}
}; AppRegistry.registerComponent('app', () => app);
'source' can also take array of assets:
<Pano
source={[asset('right.png'), asset('left.png'), asset('up.png'), asset('down.png'), asset('back.png'), asset('front.png')]}
/>
最新文章
- php 自动绑定di容器实现
- 1236 - Pairs Forming LCM -- LightOj1236 (LCM)
- MySQL字符集乱码
- Ubuntu 12.04(32位)安装Oracle 11g(32位)
- editplus3运行Python程序
- System.Net网络编程--AuthenticationManager和IAuthenticationModule
- The type MultipartEntity is deprecated
- Python中collections模块
- 前端笔记之NodeJS(二)路由&;REPL&;模块系统&;npm
- python3 练习题(用函数完成登录注册以及购物车的功能)
- javaScript系列 [06]-javaScript和this
- 动态开点线段树(陕西师范18k题)---get new skill
- 2018.11.01 NOIP训练 递增数列(迭代加深)
- spring 通过@Value 获取properties文件中设置了属性 ,与@Value # 和$的区别
- ASP.NET Web API 全局权限和异常处理
- 理解 JavaScript 中的 Function.prototype.bind
- sql server中的 trimtrailingblanks
- vuex(三)actions
- Dell 1420N使用Kubuntu默认无线驱动后网络不稳定的解决方法
- HTML表单页面的运用
热门文章
- [MongoDB实战]Part1 起步
- HDU 4686
- HDU 2817 EASY题
- WebGL 权威资源站小聚
- swift-初探webView与JS交互
- 【POJ 2182】Lost Cows
- 参照实验室这边案例做一个简单的maven webapp项目
- Fine-tuning CaffeNet for Style Recognition on “Flickr Style” Data 数据下载遇到的问题
- 在eclipse环境下使用maven install 命令碰到native2ascii-utf8问题解决方案
- 一种比较高级的方法也可以修改windows为默认启动系统