-
Notifications
You must be signed in to change notification settings - Fork 22
Open
Description
Steps to reproduce:
- clone repo
- add animation
- call
npx expo prebuild --clean - call `npx expo run:ios --device' (running it on iphone 14)
Desired scenario: The text should rotate in loop.
Actual result: The text does not rotate.
This is my code:
import React, { useState } from "react";
import { StyleSheet } from "react-native";
import {
ViroARScene,
ViroText,
ViroTrackingStateConstants,
ViroARSceneNavigator,
ViroTrackingReason,
ViroAnimations,
} from "@reactvision/react-viro";
const HelloWorldSceneAR = () => {
const [text, setText] = useState("Hello World!");
function onInitialized(state: any, reason: ViroTrackingReason) {
console.log("AR tracking state:", state, reason);
if (state === ViroTrackingStateConstants.TRACKING_NORMAL) {
setText("AR Ready!");
} else if (state === ViroTrackingStateConstants.TRACKING_UNAVAILABLE) {
setText("AR Unavailable");
} else {
setText("Initializing AR...");
}
}
return (
<ViroARScene onTrackingUpdated={onInitialized}>
<ViroText
text={text}
scale={[0.5, 0.5, 0.5]}
position={[0, 0, -1]}
style={styles.helloWorldTextStyle}
animation={{
name: "loopRotate",
run: true,
loop: true
}}
/>
</ViroARScene>
);
};
export default () => {
return (
<ViroARSceneNavigator
autofocus={true}
initialScene={{
scene: HelloWorldSceneAR,
}}
style={styles.f1}
/>
);
};
ViroAnimations.registerAnimations({
loopRotate:{
properties:{
rotateY: "+=45"
},
easing: "Linear",
duration: 200
},
});
var styles = StyleSheet.create({
f1: { flex: 1 },
helloWorldTextStyle: {
fontFamily: "Arial",
fontSize: 30,
color: "#ffffff",
textAlignVertical: "center",
textAlign: "center",
},
});
Metadata
Metadata
Assignees
Labels
No labels