How would you code this with the following constraints:
✅ pure CSS
⚠️ under 10 declarations
⚠️ 1 element
❌ no pseudos
❌ no JS
⚠️ no SVG, no images in general save for at most 2 CSS gradients
How would you code this with the following constraints:
✅ pure CSS
⚠️ under 10 declarations
⚠️ 1 element
❌ no pseudos
❌ no JS
⚠️ no SVG, no images in general save for at most 2 CSS gradients
@zastrow 1 element means 1 element, no restriction on what kind of element, but it does not mean 1 element and another element.
The 1 element can be 1 div or it can be the body, but not both. I personally used the html element.
@anatudor Well, I have a solution, but it only works in Chrome, and that is because I’ve just learned about the @property rule.
The other thing I learned about for this solution was `background-blend-mode`, which I am super excited about.
Curious about your thoughts on attempt 2:
@zastrow `@property` - yup, good start.
Why put `transform` in `@keyframes`? You can set `transform: rotate(calc(-1*var(--pos)))`. Also, the `from` keyframe isn't needed, `0deg` is the initial value set in `@property`.
Not sure what you're trying to do with the `hsl()` computations - taking that blueviolet from the gif and using it as it it with black works just fine. Also, you only have 2 background layers - only 1 blend mode is needed. How `difference` works in detail https://css-tricks.com/taming-blend-modes-difference-and-exclusion/
@zastrow If you're going to set that transform, also set `overflow: hidden` to get rid of the dancing scrollbars.
Also, ditch `forwards`. `forwards` means the value the animated property takes once the `animation` has ended is the value of the `to`/ `100%` keyframe, which means it's completely pointless to add it when the `animation` is `infinite` (never ends).
@anatudor I gave it a go, that was fun. Here is my best attempt https://codepen.io/bali_balo/pen/qByEzxv/8f52d569ed787a9465de8c3329368ed0?editors=0100
Probably doesn't count since I used both a div and the body and that's 11 rules ignoring variables anyway. Tried to make it all 1 element but seems difficult to get the rotation movement without transforms. There was some cool potential with having one background-attachment fixed and the other scroll but fixed background don't work on transformed elements :( (something like that, using a simpler animation https://codepen.io/bali_balo/pen/mdjyNxM/c6993449ee080942da2124234c26ff2a?editors=0100)
For reference, 1st demo here, except animating the angle, not emulating circular motion with carefully chosen timing functions for x & y https://mastodon.social/@anatudor/109530871757375435