Skip to content

Instantly share code, notes, and snippets.

View tejas77's full-sized avatar

tejas77

  • Rajkot, India
View GitHub Profile
@tejas77
tejas77 / towerApp.js
Created June 16, 2020 06:47
Tower Application
import React, { useState, useEffect } from "react";
import { StatusBar, Dimensions, Text, View } from "react-native";
import { DeviceMotion } from "expo-sensors";
import Svg, { Circle, Line } from "react-native-svg";
const { height, width } = Dimensions.get("window");
const centerX = width / 2,
centerY = height / 2;
export default function App() {
@tejas77
tejas77 / towerCylinderElement.js
Created June 16, 2020 06:28
Cylinder Element of Tower Application
const { height, width } = Dimensions.get("window");
const centerX = width / 2,
centerY = height / 2;
// ....
let { beta, gamma } = data;
gamma = round(gamma);
beta = round(beta);
@tejas77
tejas77 / towerShadowElement.js
Created June 16, 2020 03:01
Shadow Element of Tower Application
const { height, width } = Dimensions.get("window");
const centerX = width / 2, centerY = height / 2;
//....
const shadowElement = (
<>
<Line
x1={centerX}
y1={centerY}
@tejas77
tejas77 / deviceMotionAddListener.js
Created June 15, 2020 17:30
Adding the Device Motion Listener
const [data, setData] = useState({});
//Call Once when Screen loads
useEffect(() => {
//Subscribe Function
_subscribe();
//Call Once when Screen unloads
return () => {
_unsubscribe(); //Unsubscribe Function
};
}, []);
@tejas77
tejas77 / deviceMotionData.json
Created June 14, 2020 16:43
Device Motion Listener Data
{
"acceleration": {
"z": -0.0005327463150024414,
"y": 0.0034074783325195312,
"x": 0.0005932972417213023
},
"accelerationIncludingGravity": {
"z": -0.8134145140647888,
"y": -9.769495010375977,
"x": 0.0011865944834426045