Live data from Hacker News

An interactive mechanical contraption in pure CSS

cohost.org

31–40 of 58 posts

Re: An interactive mechanical contraption in pure CSS

#31
post #7

Does this work with a touchscreen? I’m on mobile and don’t see anything happening. (I pulled the rope.)

Tried everything. Zooming in, out, tap, swipe, just at the right spot, everywhere around etc.

Doesn't seem to work in iOS 15.5 Safari .

Re: An interactive mechanical contraption in pure CSS

#34
Super impressive use of the height of the container to set state. How it works:

The left rope has a "resize: vertical" attribute set, which lets you dynamically change the height of it with only css. This influences the height of the parent container, as it's the only div that doesn't have its height set as a percentage.

Every other div has is height set to a "calc()" with a percentage and an added set amount of pixels. This means that when the parent container resizes, their height adjusts, which also adjusts their background image. This is what drives both the rope and the gear animations, but in different ways.

The rope is straightforward - as the container grows in height, the rope bg changes position, creating a pulling effect.

The gear is more tricky. They each use a long vertical sprite sheet to portray a spinning animation. How this animation gets triggered is clever - note the background position-y of one of the large red gears. It's set to 10000%. If you set this to 100% instead, you'll notice the background of the gears moves in sync with the rope - each pixel of height of the element moves the background down by 1px. By setting it to 10000% what you're saying is, "for each single pixel of height of this element, shift the background by 100px". Notably, each one of these red gears in the sprite sheet is precisely 100px high. That means for each pixel added to the height, it shifts the sprite sheet to the next gear.

Really clever stuff.

Re: An interactive mechanical contraption in pure CSS

#36

doesn't work in firefox.

It's a bit fiddly, don't just click-drag the end of the rope, hold the mouse pointer over the end until it changes.

Yes, indeed.

The positioning of the mouse cursor over the rope end in order to pull the rope appears to be much more critical in Firefox than in Chromium/Chrome.

As mentioned, the mouse cursor must change into a double-pointed vertical arrow, to allow rope pulling, so the shape change identifies the right spot.

Re: An interactive mechanical contraption in pure CSS

#37
post #33

Doesn't work in IE11, going to have put in a ticket

I don't want to be the bearer of bad news, but IE11 has reached its EOL.

According to current stats 28 million global users still use IE. These are 28 million opportunities that the Mozilla Foundation is likely to mess up again...

Re: An interactive mechanical contraption in pure CSS

#39
post #7

Does this work with a touchscreen? I’m on mobile and don’t see anything happening. (I pulled the rope.)

Tried everything. Zooming in, out, tap, swipe, just at the right spot, everywhere around etc. Doesn't seem to work in iOS 15.5 Safari .

Not for me, either.

Re: An interactive mechanical contraption in pure CSS

#40
post #22

Is this supposed to be serious use of CSS or rather, as suggested by "Committing CSS Crimes", a critique of the absurdity of CSS?

author here. the website that hosts this is a new social media website that allows a limited amount of html (only inline css, no js or elements), and a small subculture/arms race has developed to see who can make the wildest thing under those restrictions.

Offtocpic, but are you the person behind the blackle dark google search ui?
Post reply on HN