hcodes / snowflakes

❄️ Falling snowflakes
https://hcodes.github.io/snowflakes/examples/constructor
MIT License
356 stars 58 forks source link

Vary z-index? #27

Closed strarsis closed 3 years ago

strarsis commented 5 years ago

I have a compositional header with different elements that have different z-indices. Snowflakes with varying z-index would look very cool because some of them would fall behind the header elements and some in front of them, which looks 3D and realistic.

strarsis commented 4 years ago

Edit: I notice some variation of z-indices of the snowflakes as some go over some element, and some below. However, z-indices range option and documentation for a defined behaviour would be great, because this seems to be an unintended side-effect that may be removed later if this isn't a feature.

hcodes commented 4 years ago

a snowflake - https://github.com/hcodes/snowflakes/blob/master/src/js/flake.js#L41 container - https://github.com/hcodes/snowflakes/blob/master/src/js/snowflakes.js#L40

codenchips commented 3 years ago

Edit: I notice some variation of z-indices of the snowflakes as some go over some element, and some below. However, z-indices range option and documentation for a defined behaviour would be great, because this seems to be an unintended side-effect that may be removed later if this isn't a feature.

I was looking through the source because I couldn't get zindex to work at all. I have a canvas based video on my home page which the flakes always go behind no matter what I do.

I see this line;
styleProps.zIndex = params.zIndex + this.size * 10;

Isn't that saying the zindex is set depending in the size of the flake?

hcodes commented 3 years ago

https://hcodes.github.io/snowflakes/examples/z-index.html

Small snowflakes are located at the far distance, they are located under large snowflakes.

hcodes commented 3 years ago
изображение

z-index is set for snowflake common container.

hcodes commented 3 years ago

v4.2.0

strarsis commented 2 years ago

@hcodes: Would it be possible to have individual z-indices? I have a complex scene containing elements with different z-index, and the snowflakes should correctly visually go behind/before those elements.