Demo: Spatial Manipulation

Not sure if this is going to be much of a demo; it might be more of a quick reference guide to checking the values of the position and/or size of an object on a page, and to manipulating these values on demand.

Step 1: Start with some simple value reading of a regular in-flow element

We have some text with a max-width on it; we have an figure/image combo that starts off as a centered block element. Then we float it into the text when there's enough space to support it. Fairly basic responsive effect.

This is block number one!

Architecto ex dolorum vel et et porro non. Placeat libero reiciendis consequatur et. Quis illo eos saepe quaerat. Eligendi perferendis itaque cupiditate soluta repellat ut voluptatem qui.

Step 2: Start with some simple value reading of a regular in-flow element ... but actually have it be the child of a relatively-positioned element

Basically the same thing as above except the div we're targeting is the child of a relatively positioned container div. That sets off some of our offsets. Ha ha.

This is the second block. This is inside a relatively positioned container element.

Architecto ex dolorum vel et et porro non. Placeat libero reiciendis consequatur et. Quis illo eos saepe quaerat. Eligendi perferendis itaque cupiditate soluta repellat ut voluptatem qui. Itaque iure quo voluptas possimus sunt optio ut. Quasi facere rem exercitationem et dolores. Mollitia nobis alias pariatur eum impedit. Qui soluta id quos repellat et atque.

Step 3: Calculate a few things

Back to our basic flow content: what can we calculate given the numbers we have available to us?

This is block number three! We're going to calculate a few more things to see what we can do with the numbers we have on hand.

Architecto ex dolorum vel et et porro non. Placeat libero reiciendis consequatur et. Quis illo eos saepe quaerat. Eligendi perferendis itaque cupiditate soluta repellat ut voluptatem qui.

Step 4: Wait! What about Element.getBoundingClientRect()?

Well, sure! This does help simplify some things.

I've also prepped a dynamic on-scroll demo of these results.

This is block number four, which we're going to investigate using Element.getBoundingClientRect().

Architecto ex dolorum vel et et porro non. Placeat libero reiciendis consequatur et. Quis illo eos saepe quaerat. Eligendi perferendis itaque cupiditate soluta repellat ut voluptatem qui.

Step 5: Use all this stuff to make things do stuff

I've prepped a dynamic on-scroll demo of these results.

For right now all it's really doing is checking to see if the item is completely visible, and then making it to tricks when it is. But the numbers can be broken down further to do more nuanced things, which I'll maybe take up in separate demo sheets.

Step Null: There's a kill screen coming up in Donkey Kong

I just need a bunch of empty nonsense down here so I can scroll things off the top of the page if needed.

Quidem et quos voluptate dolor quo a. Nam omnis quia ipsa sint odit harum quas. Sunt delectus dolores voluptatibus est. Non in autem corporis neque est.

Aut vitae qui sit. Esse nobis quasi atque dolorem modi. Sed soluta neque necessitatibus ea aut eum. Minus consequatur dignissimos impedit ut nemo eligendi facere. Sint et enim totam.

Animi minus quo asperiores quae aliquid nisi voluptate. Qui qui perspiciatis provident ut doloribus laboriosam ex. Atque ducimus consequatur nostrum explicabo eaque consectetur voluptatem. Autem qui ipsam et exercitationem ex fugit.

Voluptatibus odio facere aspernatur quia tenetur voluptatum ut non. Cum eveniet sapiente repellendus consequatur excepturi saepe ad. Eum consequatur cum tenetur optio.

Atque pariatur quod nobis veritatis qui vel voluptatem et. Sunt qui qui ut saepe ea ut. Natus deserunt voluptatem exercitationem facere. Consequatur cumque atque ratione. Officiis quos incidunt aut aliquam dolorem autem repudiandae dolores.

Naming Things Is Hard