New setup from scratch - all modules updated - app now in subfolder

This commit is contained in:
Martin Bauer
2023-09-29 22:04:52 +02:00
parent e28ab91935
commit 9b6bb7f126
63 changed files with 9633 additions and 44259 deletions

88
playground/FollowPaths.js Normal file
View File

@@ -0,0 +1,88 @@
import React, { Component } from 'react'
import { View, PanResponder, GestureResponderEvent } from 'react-native'
import Svg, {
Circle,
Ellipse,
G,
LinearGradient,
RadialGradient,
Line,
Path,
Polygon,
Polyline,
Rect,
Symbol,
Use,
Defs,
Stop
} from 'react-native-svg';
export default class Foo extends Component {
panResponder = null;
constructor(props) {
super(props)
this.state = { x: 200, y: 200, initX: 0, initY: 0 }
this.panResponder = PanResponder.create({
onStartShouldSetPanResponder: (evt, gestureState) => true,
onStartShouldSetPanResponderCapture: (evt, gestureState) => true,
onMoveShouldSetPanResponder: (evt, gestureState) => true,
onMoveShouldSetPanResponderCapture: (evt, gestureState) => true,
onPanResponderGrant: () => {
},
onPanResponderStart: (evt, gestureState) => {
console.log("start", gestureState);
this.setState({ initX: this.state.x, initY: this.state.y });
},
onPanResponderMove: (evt, gs) => {
//console.log(gs.dx + ' ' + gs.dy)
const newX = this.state.initX + gs.dx;
const newY = this.state.initY + gs.dy;
this.setState({ x: newX, y: newY });
},
onPanResponderTerminationRequest: (evt, gestureState) => true,
onPanResponderRelease: (evt, gs) => {
console.log('Release ' + gs.dx + ' ' + gs.dy);
//this.setState({ x: this.state.x, y: 0 });
},
onShouldBlockNativeResponder: (evt, gestureState) => {
// Returns whether this component should block native components from becoming
// the JS responder. Returns true by default. Is currently only supported on
// android.
return true;
},
})
}
componentDidMount() {
}
render() {
return (
<Svg height="500" width="500">
<Circle
{...this.panResponder.panHandlers}
x={this.state.x}
y={this.state.y}
cx="50"
cy="50"
r="20"
stroke="blue"
strokeWidth="3.5"
fill="white" />
</Svg>
)
}
}

139
playground/SliderDraft.js Normal file
View File

@@ -0,0 +1,139 @@
import React, { useRef } from "react";
import {
StyleSheet,
View,
StatusBar,
ImageBackground,
Text,
TouchableOpacity,
Animated,
PanResponder,
} from "react-native";
import EntypoIcon from "react-native-vector-icons/Entypo";
import Svg, { G, Polyline, Line, Circle, Rect, Text as SvgText } from 'react-native-svg';
let AnimatedCircle = Animated.createAnimatedComponent(Circle);
let AnimatedG = Animated.createAnimatedComponent(G);
function SliderDraftView(props) {
const pan = useRef(new Animated.ValueXY()).current;
/*
const panResponder = useRef(
PanResponder.create({
onPanResponderTerminationRequest: () => { console.log("p1"); return false; },
onStartShouldSetPanResponder: () => { console.log("p2"); return true; },
onMoveShouldSetPanResponder: () => { console.log("p3"); return true; },
//onPanResponderMove: Animated.event([
// null,
// { dx: pan.x, dy: pan.y }
//]),
onPanResponderMove: (e, gesture) => {
console.log(gesture);
},
onPanResponderRelease: () => {
console.log("release");
Animated.spring(pan, { toValue: { x: 0, y: 0 } }).start();
}
})
);//.current;
*/
const panResponder = useRef(PanResponder.create({
onStartShouldSetPanResponder: () => true,
onMoveShouldSetPanResponderCapture: () => true,
onPanResponderMove: (_, { dx, dy }) => {
console.log("bla", dx, dy);
cx.setValue(dx);
cy.setValue(dy);
setCurrentPoint({ x: dx, y: dy });
},
onPanResponderRelease: (e, { dx, dy }) => {
console.log("release", dx, dy);
cx.extractOffset();
cy.extractOffset();
offsetX = offsetX + dx;
offsetY = offsetY + dy;
}
})).current;
console.log({ ...panResponder.panHandlers });
return (
<View style={{ flex: 1 }}>
<StatusBar barStyle="light-content" backgroundColor="rgba(0,0,0,0.4)" translucent={true} />
<ImageBackground
source={require("../assets/pool_sky_background_blurred.jpg")}
resizeMode="cover"
style={{ flex: 1 }}
>
<View style={setupViewStyles.container}>
<View style={{ flexDirection: "row", alignItems: "center" }}>
{props.backButton &&
<TouchableOpacity onPress={() => props.navigation.goBack()}>
<EntypoIcon name="chevron-left" style={setupViewStyles.backButton}></EntypoIcon>
</TouchableOpacity>
}
<Text style={setupViewStyles.headerText}>
Slider Draft
</Text>
</View>
<View style={{ flex: 1, justifyContent: "center" }}>
<Svg height="100%" width="100%" viewBox="0 0 200 200" {...panResponder.panHandler}>
<Rect x="10" y="10" rx="15" width="160" height="40" fill="rgba(255, 255, 255, 0.7)" />
<SvgText x="85" y="34" fill="rgba(80, 80, 80, 1)">42</SvgText>
<AnimatedCircle
x={pan.x} y={pan.y} r="20"
></AnimatedCircle>
<G >
<Line x1="25" y1="20" x2="25" y2="40" stroke="rgba(80, 80, 80, 0.7)" />
<Line x1="45" y1="20" x2="45" y2="40" stroke="rgba(80, 80, 80, 0.7)" />
<Line x1="65" y1="20" x2="65" y2="40" stroke="rgba(80, 80, 80, 0.7)" />
<Line x1="85" y1="20" x2="85" y2="40" stroke="rgba(80, 80, 80, 0.7)" />
<Line x1="105" y1="20" x2="105" y2="40" stroke="rgba(80, 80, 80, 0.7)" />
<Line x1="125" y1="20" x2="125" y2="40" stroke="rgba(80, 80, 80, 0.7)" />
<Line x1="145" y1="20" x2="145" y2="40" stroke="rgba(80, 80, 80, 0.7)" />
</G>
</Svg>
</View>
</View>
</ImageBackground>
</View>
)
}
const setupViewStyles = StyleSheet.create({
container: {
flex: 1,
justifyContent: "space-between",
width: "80%",
marginLeft: 40,
marginTop: 60,
},
headerText: {
color: "rgba(255,255,255,1)",
fontSize: 25,
},
subtext: {
color: "rgba(255,255,255,1)",
textAlign: "left",
fontSize: 18,
lineHeight: 25,
width: "80%",
marginBottom: 50,
},
backButton: {
color: "rgba(255,255,255,1)",
fontSize: 40
},
});
export default SliderDraftView;

View File

@@ -0,0 +1,22 @@
# %%
import msgpack
#data = [130, 164, 116, 105, 109, 101, 206, 0, 7, 200, 131, 163, 109, 115, 103, 217, 56, 110, 101, 119, 32, 119, 101, 98, 115, 111, 99, 107, 101, 116, 32, 99, 111, 110, 110, 101, 99, 116, 105, 111, 110, 44, 32, 115, 116, 111, 114, 105, 110, 103, 32, 97, 116, 32, 112, 111, 115, 32, 49, 32, 45, 32, 111, 99, 99, 117, 112, 97, 110, 99, 121, 58]
#data = [130, 164, 116, 105, 109, 101, 206, 0, 4, 35, 94, 163, 109, 115, 103, 217, 55, 110, 101, 119, 32, 119, 101, 98, 115, 111, 99, 107, 101, 116, 32, 99, 111, 110, 110, 101, 99, 116, 105, 111, 110, 44, 32, 115, 116, 111, 114, 105, 110, 103, 32, 97, 116, 32, 112, 111, 115, 32, 49, 32, 45, 32, 111, 99, 99, 117, 112, 97, 110, 99, 121]
data = [130, 164, 116, 105, 109, 101, 205, 14, 216, 163, 109, 115, 103, 217, 37, 83, 112, 105, 102, 102, 115, 32, 115, 105, 122, 101, 58, 32, 49, 50, 32, 77, 66, 44, 32, 115, 101, 116, 117, 112, 32, 116, 105, 109, 101, 32, 49, 32, 115, 101, 99]
byte_data = b''
for e in data:
byte_data += e.to_bytes(1, "big")
#print("length", len(byte_data))
#print(byte_data.decode(errors="ignore"))
#print(msgpack.unpackb(byte_data))
# %%
for i, e in enumerate(data):
print(i, ":", e, bin(e), chr(e))
# %%
#last_msg = data[17:]
#print("len last msg", len(last_msg))
# %%