I see there is an option for transitionConfig to enter values such as the animation style or the duration. I was wondering if there was a way to change the color of the background during the transition (the semi-transparent background that appears during the transition)? For example, I have fairly dark screens and during the transition the background kind of flashes white.
Is this either configurable directly, or is it maybe a property of the parent navigator?
Thanks
I see during the transition process the area between the focussed screen and the edge of the screen goes from white with an opacity of 1 to transparent. Is it possible to maybe begin from another color such as black?
Try adding:
cardStyle: {
backgroundColor: 'white'
},
in your StackNavigatorConfig
I solved this issue by adding this to my StackNavigator:
cardStyle: {
backgroundColor: 'rgba(0,0,0,0)',
opacity: 1,
},
Now the transition is completely transparent. I tried using only opacity: 1 as suggested but it didn't work. I'm using "react-navigation": "^1.5.11".
If you are were a TabBarNavigator component then you can have a look at this part of the documentation to fix color problems during transitions.
If you combine swipeEnabled, animationEnabled and lazy properties you will get a better result in transitions. Otherwise, a gray/transparent color will be used during screens' transitions.
const tabNavigatorConfig: TabNavigatorConfig = {
...
swipeEnabled: true,
animationEnabled: false,
lazy: false,
...
};
Related
I want to make this image or widget at the end transparent with a LinearGradient gradient.
Honestly I'm not entirely sure how to do this, because I only know how to make the entire image/widget transparent with the Opacity widget.
Can someone help me here with an general idea, how to do this?#
[]
[]
In the end the answer was fairly simple because there is already a widget available for this task. the widget name is ShadowMask.
Here is the part of the code which enabled me to get the above effect.
return ShaderMask(
shaderCallback: (rect) => LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [Colors.white, Colors.white.withOpacity(.2), Colors.transparent],
stops: [.6,.8, .9],
).createShader(rect),
child: ...
Depending on which degree you want to achieve this effect you can change the color or stops for it.
I have a free form image with transparency (let's say, a small image of a blue car). The image has transparency, so that I can place the car on the map of a game.
Now, some areas of the game map are bluish, and the car kinda blends in. Is it possible to add a white border automatically in QML? I can't use GIMP or other things to work directly on the image (and I have lots of such images to manipulate) so it would be awesome if there was a QML builtin functionality for this...
In situations like this, a drop shadow is a good way of making an item standout. You normally would make it black or white based on the opposite of the average gray level of the image content itself.
It's pretty easy to add a DropShadow to an Image. This example places a nice light black drop shadow onto an image.
import QtGraphicalEffects 1.0
Image {
source: "my_image.png"
layer.enabled: true
layer.effect: DropShadow {
verticalOffset: 3
horizontalOffset: 0
radius: 8
color: "#26000000"
}
}
For more info see: https://doc.qt.io/qt-5/qml-qtgraphicaleffects-dropshadow.html
If you want a centered box shadow instead, just use a Rectangle somewhat like this:
Rectangle {
layer.enabled: true
layer.effect: DropShadow {
radius: 8
color: "#26000000"
}
Image {
source: "my_image.png"
}
}
Or if you just want a white border only:
Rectangle {
color: "transparent"
border.color: "white"
border.width: 2
Image {
source: "my_image.png"
}
}
I am testing SVG performance using RaphaelJS library.
My code works, can be found here: JSFiddle
When you type in textbox "1" and press "add", a rectangle will be generated on screen and 4 animations will loop on it- moving right, down, left, up (also rotating, scaling and changing colour).
Performance seems to be ok. But add another element on stage and the performance gets knocked down to minimum in 3-4 seconds. Checked in Chrome timeline, the thing that is getting stacked up is "Animation Frame Fired - > Install Timer".
Perhaps I am doing loop incorrectly? Altough next animation starts when the previous ends, through callback function. Or is it Raphael itself? Should I try doing this with SVG and SMIL? (Raphael uses VML)
Any ideas?
------------------------------------UPDATE--------------------------------------
With RaphaelJS I did bad animation loop hooks, see answer below.
But another problem that does occur - add 1 element 10 times and you can see how animations get distorted, not finishing their full cycle, or add 10 elements 1 time and after few seconds you can see delayed animations on some of the elements.
I made SMIL version JSFiddle (no Raphael here), animations do not lag, delay, but they get syncronized. Can anyone explain why? And how to make those animations NOT sync, but unique?
I think the problem is you are recursively calling animations on a set.
So at the end of each animation, each element in the set calls an animation for the set again, so it spirals and grinds to a halt. You can get around this, by using 'this' instead of the set 'rectangles'.
//define 4 animations
var move_up = Raphael.animation({fill: "green", transform: "t0,0r360s1,1"}, 400, function(){ this.attr({"transform" : "t0,0"}); this.animate(move_right); });
var move_left = Raphael.animation({fill: "yellow", transform: "t0,100r270s0.5,0.5"}, 400, function(){ this.animate(move_up); });
var move_down = Raphael.animation({fill: "red", transform: "t100,100r180s1,1"}, 400, function(){ this.animate(move_left); });
var move_right = Raphael.animation({fill: "blue", transform: "t100,0r90s1.5,1.5"}, 400, function(){this.animate(move_down); });
jsfiddle
I’m using Qt Creator. In my GUI I use a tab widget. This widget should have the same grey background color as the main window (picture A). I accomplished this by editing the Style Sheet in Qt Designer with:
background-colour: rgb(240, 240, 240);
But now I have two new problems I can’t solve:
The buttons (--> Send) are not rounded anymore.
The edit boxes’ background color has changed to grey, too.
Befor I changed the Style Sheet the GUI looked like in Picture B.
I also tried
QPalette pal = m_pUi->tabWidget->palette();
pal.setColor(m_pUi->tabWidget->backgroundRole(), Qt::blue);
m_pUi->tabWidget->setPalette(pal);
but this only changes the color behind the tabs, not the entire color of the whole "tab-window-surface".
Do I have to make additional style descriptions or is there an more simple solution?
Picture A - with Style Sheet
Picture B - without Style Sheet
I had the same problem and I discovered that you need to set this attribute to each one of your tabs:
ui->tab->setAutoFillBackground(true);
I'm not sure, but I think that also is necessary set that attribute to the QTabWidget as such.
I hope this help.
The "things" you want to access are called QTabBars. Keeping that in mind you can write a stylesheet like this:
QTabBar::tab
{
background: #48555E;
color: white;
border-color: #48555E;
}
QTabBar::tab:selected,
QTabBar::tab:hover
{
border-top-color: #1D2A32;
border-color: #40494E;
color: black;
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #C1D8E8, stop: 1 #F0F5F8);
}
Also you might find this question and this official documentation insightful.
I have a graph that contains nodes (groups) composed by inner nodes and when redering the graph, the groups are shown on top of the nodes they contain (I'm using a presset layout). In order to avoid that I have tried setting a z-index (so then only the border of the group is visible) for the groups as shown bellow with no luck.
style:{
selectors:{
'.group':{
fillColor: '#000000',
borderColor: '#000000',
borderWidth: 1,
shape:'roundrectangle',
'z-index':-5
//visibility:'hidden'
}
}
}
I also tried setting visibility:'hidden' but that hides the edges connecting the group as well. Is there any support for groups ? or maybe a way of setting the group fillColor as transparent so it doesn't hide its inner nodes?
The SVG renderer should accept transparent as a valid colour, as far as I can remember. What you're really looking for sounds like compound node support, which we'll have when the new canvas renderer is done -- by the end of the summer.