My Issue
React Native Router Flux scene transition on android is painfully slow. I have a listview with images with about 80 rows of restaurant titles. Each row has a touchable button that pushes a detail scene of the restaurant. List loading speed is fine, so I don't think that's the bottleneck. I have disabled the "push" animation (duration={1}) and it seems to help out some. However I am wanting to disable the animation of sliding back into the listview as well. How can I achieve pretty much no animations on android? Action.push() & Action.pop()?
My Code
<Scene key="DirectoryDetailAndroid" duration={1} navigationBarStyle={styleNavigationBarStyle} backTitle={backButtonIcon} titleStyle={styleTitleStyle} type="push" hideBackImage={true} component={DirectoryDetailAndroid} title="Directory Detail" />
What I have tried
I have tried a scene reset, making sure there were no console.log's in my redux anywhere. I have implemented the interaction manager on the scene I push to as well.
Side note, if anyone knows of a better solution for android slow scene transitions or different navigator component for android, I'm all ears.
Related
I'm trying to run an animation based on scroll in the background of a React app.
I use Threejs with React Three Fiber. In R3F, there is a hook called useScroll which I want to use.
Problem is that my Threejs scene (a Canvas) is in the background with zIndex: -100, so the scroll handler doesn't get the user input.
If I remove the zIndex property, everything works, but It's not what I want.
The scene look like this demo, the only difference is that mine has element in front.
I don't know if the solution is to use a different css style or something more complexe to allow the handler to do his job. I've been looking at React Portal but I don't think it will work.
Any ideas ?
Thanks in advance.
I have a "cover" image for the top of one of my views that i'd love to be able to blur out as you scroll it out of view as a cool effect.
My state contains a blurRadius property, which i am binding to the blurRadius={this.state.blurRadius} prop on my <Image> component.
I have a <ScrollView> and am monitoring when it's scrolled with onScroll, where i am calling setState({blurRadius: value}) - value being the distance that you've scrolled the view.
I've also set the scrollEventThrottle={30} prop on the scrollview so that i'm receiving the event regularly as the user scrolls.
The issue seems to be that the blurRadius updates but after a significant delay - and only to the maximum value. Am i missing something in order to make the image apply the new blurRadius with every call of setState?
Could it be that the image is just too large?
You should not use setState to set anything as a response to onScroll, as this leads to poor performance. The reason is that the whole view will rerender for every call to setState, which leads to "view thrashing".
Instead, you should use the Animated API, as this 'declares' the animation to the native UI thread, thus avoiding rerenders.
Brent Vatne (from the Expo team) gives a great explanation of Animated as well as a concrete example of animations as a response to onScroll events in ScrollView here
Hope it helps someone :-)
You can try using setNativeProps instead of setState to see if the performance improves. You just need to give your Image a ref.
this.refs.myImage.setNativeProps({ blurRadius: myValue });
Reducing the image size would also help as it would not need to blur as many pixels.
I'm using Unity 5 and OVR utilities, I'd like to avoid the scene being recentered every time I load a new scene. Basically, I'd like the player to be able to sit down and even if he's looking at his right at the moment of a new scene loading, I'd like him to be able to continue playing without having to use some manual recentering or having to change his sitting position.
I've found 2 other posts with the same question but only for other VR platforms and they didn't solve my problem:
Persist Google Cardboard forward direction across scene loads in Unity3D 4.6.7?
Google Cardboard - how to face the same way when changing scenes?
Turns out, if you're using OVR Utilities from Oculus, there's a very simple boolean-based solution that you can set in the Editor:
Find the OVRManager script attached to the OVRCameraRig
Uncheck 'Reset Tracker On Load'
I'm developing a 2D game in Unity (Version 5.1.2) which has an animation.
The animation is generated by flipping through the sprites in the sprite sheet.
My problem is that the animation is playing as it should in the "Scene View" but not in "Game View".
I normally create animations by using the sprite editor and then drag & drop all the sprites on the screen (Scene View).
It creates a Sprite Renderer to switch the sprites but I would like the Image Component to flip through the sprites. It seems like only sprites in the Image Component is being displayed in the "Game View".
Is there any way I can get some assistance on this please.
Its really strange that you are only seeing that in your Scene View. If the animation is your default animation? Otherwise, make sure that you are sending the right parameters to your animator. A good way to test it is opening your Animator windows, checking all transitions, and manually filling the parameters to see how it works wile the game is running. Also, check if the transitions between animations has exit times and transition durations, and disable them.
I'm currently building a 2d platformer and encountered a few problems.
My player has a script so that when the player hits a cube with a rigid body, the cube can be pushed. When the character pushes the object, the regular walking animation is displayed.
I want to play the pushing animation at that moment but cant seem to fix it. I read a lot of topics on the internet about the difference between unity new Animator editor and the older versions.
Is there a simple way to trigger the animation on hit, and how do I have to add it in the Animator? Also with witch states should it be connected?
Found it on google, maybe it will help
http://unity3d.com/learn/tutorials/modules/beginner/2d/2d-overview
He uses a Layer for the animation of the cannon so he animates regardless of the body animation.