Page Flashing On Scroll - background-image

Any ideas why this page: http://mpdteam.net/projects.html is flashing when it scrolls? I've determined it's due to the background of the main content container, but why? is it a eye-trick, an image flaw, a browser flaw, or a code flaw? The code is easily viewable with view source or dev tools.
Let me know if you need anymore info. thanks.
(also, feel free to re-tag. i'm having a mind-blank for good tags)

It's because it uses finely spaced grey and white lines.
It is perhaps an example of the Moiré pattern, although this is more typically reserved for two overlapping grids at different angles.
I always assumed on a PC this occurred because of the redraw time between the two colours, and how finely spaced the lines are. The lines not perfectly aligning with pixels (e.g. anti-aliasing) would further enhance the flickering effect.
To fix it, try changing the size of the bands (e.g. try zooming out or in on the current page, and moving the browser, and note how you get reduced and even none of the described flickering effect).
Alternatively, you may want to apply a blur such that the difference between bands was softened (not sure if this would necessarily help).
Another suggestion that research yields is that it is due to background redrawing/scaling. However, a fixed background (as compared to a repeating one) isn't particularly applicable to your page.
In any case, for an in-depth discussion of some of the concepts involved, check out this awesome page (http://www.techmind.org/lcd/)

Related

NSWindow shrink to fit content with padding

I'm new to cocoa development and wondering what the right approach would be to the following:
I have a window with controls who's size is dynamic. In other words, I don't know the width of the window in advance. I also want to give the window a padding of 15px. In the CSS world I would simply pad a div and make it inline to accomplish this. I can't seem to figure out how to do this with NSWindow/NSView.
Question is too vague to be sure, but IFF I'm understanding you, you want a subview of the window to resize itself to always be 15pixels from the left and right sides of the enclosing window (for example).
here are the two constraints (as set up in Interface Builder, but you can do the same thing from code):
That's one view whose width is set to adjust while keeping the left and right padding to the window frame at 15 pixels (points actually, but don't worry about that).
As your view hierarchy gets more complicated you'll use different techniques for different pieces of the layout. Which is why matt was suggesting that you haven't been specific enough to actually answer a question. (What specific part of what you are you trying to do isn't working and what did you try that didn't work?). I've shown you the first step of the simplest outer layer above and it reflects a principle that carries down through your view hierarchy, but there are other cases - two items with the same width, three items with the same horizontal space between them, and so on - that require different techniques.
It sounds reading the auto layout documentation all the way through would be helpful for you. It talks about different types of relations (Equal is what I used below) and some on techniques. Unfortunately Apple's documentation situation is a bit of a mess at the moment which makes this more difficult than it should be (sigh).
What used to be the definitive auto layout guide is "unmaintained" and the place that documentation seems to be heading is incomplete and certainly less accessible. The most useful part for this context is the NSLayoutContraint documentation, though that links to the "Unmaintained" document noted above (sigh).

Usage of "Don't Clear" in "Clear Flags" property of Camera

In Unity's Camera component, there is a property Clear Flags which allows to choose from four options: Skybox, Solid Color, Depth Only and Don't Clear.
As documentation says:
Don’t clear
This mode does not clear either the color or the depth buffer. The
result is that each frame is drawn over the next, resulting in a
smear-looking effect. This isn’t typically used in games, and would
more likely be used with a custom shader.
Note that on some GPUs (mostly mobile GPUs), not clearing the screen
might result in the contents of it being undefined in the next frame.
On some systems, the screen may contain the previous frame image, a
solid black screen, or random colored pixels.
"This isn't typically used in games and would more likely be used with a custom shader"
So my question is :
How to use it in a custom shader and What effects can be achieved by using it?
Has anyone ever used it or has a good explanation about the basic concept.
Thanks
An idea would be those enemy encounter effects in Final Fantasy games. Look at the top edge of this gif to see the smearing effects of previous frames. This is probably combined with blur/rotation.
Thread question is a bit old, however I had this problem and solved it.
I've made a Screen Image Effect that reproduces this effect, you can see it here:
https://github.com/falconmick/ClearFlagsMobile
Hope this helps!

Unity sprites don't render properly

I recently came across a problem I can't solve which involves not being able to draw my sprites properly. I have tried a lot of different things and couldn't find any solution.
Here is how the image should look like in unity:
And here is how it actually looks like:
If someone could tell me how to fix this, I would be very grateful.
Presumably the top image is a screenshot of your image manipulation program, many of which use the chequerboard pattern to mean transparency. As such, the image you have exported is a gradient going from almost solid white at the bottom to transparent at the top. This is why the image appears as such in Unity.
Also, if you're wondering why the image appears as though it has bands of different colours, this is due to a problem called colour banding. This can be fixed by using a technique called Dither (which adds some noise to the image), but how you do so will depend on which image manipulation program you are using.

Mapbox Studio - layer ordering / z-index

I am following the source quickstart tutorial. I have followed the tutorial all the way through, and am having trouble displaying the earthquake data (red circles) above the land vectors.
According to the symbol drawing order documentation:
“Higher” layers obscure “lower” ones.
However I'm not finding this to be the case. Please see attached screenshot:
The 'earthquakes' layer is the 'higher' layer, I think. I am using the 'Comic!' base map styles. Since the road lines also appear to 'mask off' the land vectors and show the earthquake data below, I'm wondering if this is causing the issue, but looking through the styles there's nothing obvious I can see.
Thanks for any help.
The documentation is correct, however the comp-op family of CartoCSS properties affect how the colors of different layers interact with each other. In this case, the marker-comp-op: screen from the quickstart example was designed to work well over a darker satellite background, but becomes nearly invisible over solid white.
If you remove the marker-comp-op property or change it to a different compositing operation such as multiply the earthquake markers should show up fine.

Finding a free space within current bounds of view on iOS

I have an infinite scrollview in which I add images as the user scrolls. Those images have varying heights and I've been trying to come up with the best way of finding a clear space inside the current bounds of the view that would allow me to add the image view.
Is there anything built-in that would make my search more efficient?
The problem is I want the images to be sort of glued to one another with no blank space between them. Making the search through 320x480 pixels tends to be quite a CPU hog. Does anyone know an efficient method to do it?
Thanks!
It seems that you're scrolling this thing vertically (you mentioned varying image heights).
There's nothing built in to UIScrollView that will do this for you. You'll have to track your UIImageView subviews manually. You could simply maintain the max y coordinate occupied by you images as you add them.
You might consider using UITableView instead, and implementing a very customized tableView:heightForRowAtIndexPath: in your delegate. You would probably need to do something special with the actual cells as well, but it would seem to make your job a little easier.
Also, for what it's worth, you might find a way to avoid making your solution infinite. Be careful about your memory footprint! iOS will shut your app off if things get out of hand.
UPDATE
Ok, now I understand what you're going for. I had imagined that you were presenting photographs or something rectangular like that. If I were trying to cover a scroll view with UILeafs (wah wah) I would take a statistical approach. I would 'paint' leaves randomly along horizontal/vertical strips as the user scrolls. Perhaps that's what you're doing already? Whatever you're doing I think it looks good.
Now I guess that the reason you're asking is to prevent the little random white spots that show through - is that right? If I may suggest a different solution: try to color the background of your scroll view to something earthy that looks good if it shows through here and there.
Also, it occurred to me that you could use a larger template image -- something that already has a nice distribution of leaves -- with transparency all along the outside outline of the leaves but nowhere else. Then you could tile these, but with overlap, so that the alpha just shows through to the leaves below. You could have a number of these images so that it doesn't look obvious. This would take away all of the uncertainty and make your retiling very efficient.
Also, consider learning about CoreAnimation (CALayer in particular) and CoreGraphics/Quartz 2D ). Proper use of these libraries will probably yield great improvements in rendering speed.
UPDATE 2:
If your images are all 150px wide, then split your scrollview into columns and add/remove based on those (as discussed in chat).
Good luck!