Skip to content

Instantly share code, notes, and snippets.

View igalata's full-sized avatar
🎯
Focusing

Irina Galata igalata

🎯
Focusing
View GitHub Profile
const Box2D = require('box2dweb');
const b2World = Box2D.Dynamics.b2World;
const b2Vec2 = Box2D.Common.Math.b2Vec2;
const b2BodyDef = Box2D.Dynamics.b2BodyDef;
const b2Body = Box2D.Dynamics.b2Body;
const b2FixtureDef = Box2D.Dynamics.b2FixtureDef;
const b2PolygonShape = Box2D.Collision.Shapes.b2PolygonShape;
export default class Wall {
constructor(startPosition, endPosition, world) {
module.exports = `
precision highp float;
varying vec2 uv;
uniform vec4 color;
uniform vec2 location;
uniform float radius;
uniform float ratio;
void main () {
vec2 currentPosition = vec2(uv.x, uv.y / ratio);
05-03 10:56:33.001 665 782 I ReactNativeJS: I`m redrawn!
05-03 10:56:33.011 665 782 I ReactNativeJS: I`m redrawn!
05-03 10:56:33.021 665 782 I ReactNativeJS: I`m redrawn!
05-03 10:56:33.030 665 782 I ReactNativeJS: I`m redrawn!
05-03 10:56:33.040 665 782 I ReactNativeJS: I`m redrawn!
05-03 10:56:33.049 665 782 I ReactNativeJS: I`m redrawn!
05-03 10:56:33.059 665 782 I ReactNativeJS: I`m redrawn!
...
05-03 10:56:33.934 665 782 I ReactNativeJS: I`m redrawn!
05-03 10:56:33.945 665 782 I ReactNativeJS: I`m redrawn!
import React, {Component} from "react";
import {View, AppRegistry} from "react-native";
import {Surface} from "gl-react-native";
import GL from "gl-react";
const Dimensions = require('Dimensions');
const window = Dimensions.get('window');
import Triangle from './triangle';
export default class GLExample extends Component {
render () {
const Box2D = require('box2dweb');
const b2World = Box2D.Dynamics.b2World;
const b2Vec2 = Box2D.Common.Math.b2Vec2;
const b2BodyDef = Box2D.Dynamics.b2BodyDef;
const b2Body = Box2D.Dynamics.b2Body;
const b2FixtureDef = Box2D.Dynamics.b2FixtureDef;
const b2CircleShape = Box2D.Collision.Shapes.b2CircleShape;
var body;
import React, {Component} from "react";
import {View, AppRegistry} from "react-native";
import {Surface} from "gl-react-native";
import GL from "gl-react";
const Dimensions = require('Dimensions');
const window = Dimensions.get('window');
import Triangle from './triangle';
export default class GLExample extends Component {
render () {
module.exports = `
precision highp float;
varying vec2 uv;
float area(float x1, float y1, float x2, float y2, float x3, float y3) {
return abs(0.5 * (x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2)));
}
bool equal(float a, float b) {
return abs(a - b) < 0.00001;
function openCamera() {
camera.openCamera((uri) => {
console.log(uri);
},
(error) => {
console.log(error);
}
);
}
class CameraModule(context: ReactApplicationContext?) : ReactContextBaseJavaModule(context),
ActivityEventListener {
companion object {
private const val CAMERA_REQUEST_CODE = 1
}
init {
reactApplicationContext.addActivityEventListener(this)
}
class MainApplication : Application(), ReactApplication {
private val mReactNativeHost = object : ReactNativeHost(this) {
override fun getUseDeveloperSupport() = BuildConfig.DEBUG
override fun getPackages() = listOf(
MainReactPackage(),
CameraReactPackage()
)
}