threejs setClearColor setting the opacity to 0 although the background is not there - background

I want to set the background color to blank, using the renderer.setClearColor (0xff0000, 0)[setClearColor ]:Changing three.js background to transparent or other color, setting the opacity to 0, although the background is not there, but on the page, there is almost no model
I have added some photo instructions,but the reputation is not enough, please check the link :https://github.com/shunzizhan/threejsDemo/wiki/three-scene

this.renderer = new WebGLRenderer({
antialias: true,
alpha: true
})
Set properties alpha true and then
this.renderer.setClearColor(0xffffff, 0)
it works

Related

wix React-Native-Navigation V1 transparent background not working as expected

I'm trying to set the screen background to transparent using this navigator property:
screenBackgroundColor: 'transparent'
In addition, I changed the root view background color to Green in XCode like this:
self.window.backgroundColor = [UIColor greenColor];
I'm expecting to see the Green background without any interference . When running in Simulator I see a black rectangle with some opacity and a gradient toward the green color on the margins... (please see screenshot below) how to fix that? Maybe I'm missing some flag??
black rectangle instead of green background
I'm also using these other navigator style properties:
navBarTranslucent: true
navBarTransparent: true,
navBarNoBorder: true,
drawUnderNavBar: true
navBarTranslucent:true,
navBarBlur: false,
here I try to set the NavBar to Red background color and it still not working:
navbar background color red instead of transparent - still not working

Titanium/ Alloy: Reapply styles on when screen is resized

I have some basic styles like:
"#foo": {
backgroundColor: '#ff0000', // red
}
"#foo[if=Alloy.Globals.isSmallHeight]": {
backgroundColor: '#0000ff', // blue
}
in alloy.js I have the following:
function pxToDp(px){
return px / (Titanium.Platform.displayCaps.dpi / 160);
}
var screenWidth;
var screenHeight;
if (Ti.Platform.name == "android") {
screenWidth = pxToDp(Ti.Platform.displayCaps.platformWidth);
screenHeight = pxToDp(Ti.Platform.displayCaps.platformHeight);
} else {
screenWidth = Ti.Platform.displayCaps.platformWidth;
screenHidth = Ti.Platform.displayCaps.platformHeight;
}
Alloy.Globals.isSmallHeight= screenHeight <= 545;
This basically means the background colour of #foo is blue if the screen height is less than or equal to 545dp, and red otherwise.
This usually works fine. However, there are times when the height of the screen can change during run-time. For example:
Screen Orientation Change
Multi window (on Android)
Adjusting the splitter position while in multi window mode (Android)
The issue with this is that the styles are not re-applied to take into account the new screen width and screen height.
For example, let's say there is a screen of size 600dp x 300dp in the portrait position. #foo will correctly have a background colour of red.
However, if the orientation changes, the screen size is now: 300dp x 600dp, but the #foo does not re-check the height a background colour, and thus is still red instead of blue.
A similar issue occurs when going into split screen.
Therefore my question is, how can I reapply styles when the screen dimensions changes?
Have a look at the dynamic styles section in the documentation
http://docs.appcelerator.com/platform/latest/#!/guide/Dynamic_Styling
http://docs.appcelerator.com/platform/latest/#!/guide/Dynamic_Styles
it will give you a basic idea on how to create style at runtime and apply them. You could do this inside the orientation change event

Repeatbehavior does not make animation end properly

I have a coloranimation in a UWP application to animate the background of a TextBox:
animation = new ColorAnimation();
animation.Duration = TimeSpan.FromMilliseconds(600);
animation.From = Colors.White;
animation.To = Color.FromArgb(255, 40, 40, 40);
animation.RepeatBehavior = new RepeatBehavior(2);
flashStoryBoard = new Storyboard();
flashStoryBoard.Children.Add(animation);
Storyboard.SetTarget(animation, MyBox);
Storyboard.SetTargetProperty(animation, "(Panel.Background).(SolidColorBrush.Color)");
When I run the animation above, the animation ends in the TextBox having a white background color instead of the expected default (which is the dark 40, 40 ,40 color..). When I remove the repeatbehavior the animation runs just fine but of course only once. There are no easing functions applied. When I set the fillbehavior to stop, I get a flickering effect at the end of the animation.
Any ideas?
When I run the animation above, the animation ends in the TextBox having a white background color instead of the expected default (which is the dark 40, 40 ,40 color..).
I'm not able to reproduce this problem, by my side it ends with the color "FF404040". Maybe you can create a new blank project and try your posted code again. Or you can share your sample with us.
When I set the fillbehavior to stop, I get a flickering effect at the end of the animation.
I think you are trying to make the TextBox's background changed from white to dark gray twice when the TextBox is loaded, but when set RepeatBehavior equals or over two times, it will flicker one more time very quickly in the end.
I found a workaround for this scenario, it makes the animation ending with the color "FF404040" and will not flicker in the end:
Storyboard flashStoryBoard = new Storyboard();
ColorAnimation animation = new ColorAnimation();
animation.Duration = TimeSpan.FromMilliseconds(600);
animation.To = Colors.White;
animation.From = Color.FromArgb(255, 40, 40, 40);
animation.RepeatBehavior = new RepeatBehavior(2);
animation.AutoReverse = true;
flashStoryBoard.Children.Add(animation);
Storyboard.SetTarget(animation, MyBox);
Storyboard.SetTargetProperty(animation, "(Panel.Background).(SolidColorBrush.Color)");
flashStoryBoard.Begin();
As you can see in my code, I swap the animation.To and the animation.From, and set the AutoReverse property to true. Since your animation's Duration is only 0.6s, I think this method will not effect the user experience and can solve the flickering problem.

bxSlider one slide 100% height

I have a problem with bxSlider on one slide "referencie" I need set 100% height but with no luck, examle you can view at g.fancystudio.sk
bxslider provides that option.
Use the option 'adaptiveHeight'
Dynamically adjust slider height based on each slide's height
default: false
options: boolean (true / false)
$('.bxslider').bxSlider({
adaptiveHeight: true,
mode: 'slide'
});

QML:Transparency for an rectangle is not working

How to set transparency of an rectangle/screen.
I have Following code:
// main.cpp
void main(int argc, char*[] argv)
{
QApplication::setGraphicsSystem("raster");
QApplication app(argc, argv);
QDeclerativeView view;
view.setSource(QUrl::fromLocalFile("loaderTest.qml"));
view.setResizeMode(QDeclarativeView::SizeRootObjectToView);
view.showFullScreen();
//QRegion mask(10, 10, 100, 100);
//view.setMask();
view.show();
app.exec();
}
And QML file is:
//loaderTest.qml
Rectangle
{
id: mainRectangle
width: 1000
height: 700
color: "transparent"
//color: "#00000000"
Image
{
id: image1;
width: 348;
height: 155;
anchors.horizontalCenter: parent.horizontalCenter;
anchors.verticalCenter: parent.verticalCenter;
source: "test.png"
}
Loader
{
id: mainLoader
anchors.fill: parent;
source: "";
focus: true;
}
}
I have one loader and one image in this screen and background color is transparent.
When i run this application it should display transparent background with image in the center (as i have not set loader source).
but what i am getting is image in center with white background filled in the screen, I don’t know who is filling in this white background color as i have mentioned transparent color as background.
I am using QT.4.7.0 and Linux.
I have two planes on my target system one is Video plane and another is graphics plane, when i run GUI with transparent background (set transparency at video place) it should display video on Video place in above example it is showing background as white, as it should have displayed video playing on Video plane.
By default the QDeclarativeView paints a background. Maybe that's the problem in your case.
From http://doc.qt.nokia.com/4.7/qdeclarativeperformance.html
You can also prevent QDeclarativeView from painting its window background if you will provide the background of your application using QML, e.g.
QDeclarativeView window;
window.setAttribute(Qt::WA_OpaquePaintEvent);
window.setAttribute(Qt::WA_NoSystemBackground);
window.viewport()->setAttribute(Qt::WA_OpaquePaintEvent);
window.viewport()->setAttribute(Qt::WA_NoSystemBackground);
My first guess is that the background is white and your rectangle is indeed fully transparent.
What type is LoaderScreen, I guess it is some sort of QDecalarativeView, please forgive any technical misses have not coded Qt/QML for almost a year now. As I remember it the default background of the view was white and what kind of transparency are you hoping to achive anyways?
If you only set a background-color on a QPushButton, the background may not appear unless you set the border property to some value. This is because, by default, the QPushButton draws a native border which completely overlaps the background-color.
This might show a black rectangular box around QPushButton. You will face this issue especially on Linux machines. In order to avoid this you can set the border property to none
widget->setStyleSheet("border:none");