TED Talk 主页如何组织视频网格?
我一直在尝试弄清楚TED Talk 主页到底是如何工作的。抛开所有的动画垃圾不谈,我发现盒子的组织方式真的很有趣。
乍一看,它看起来像 jQuery masonry 插件,但很快就会发现它倾向于创建几个直角三角形,但没有固定的列数或行数,并且最终产生的形状始终是完全实心的(没有空心部分)。
我最初的假设是,这些盒子(它们的大小是由网站上的某些因素预先确定的)被随机排序,然后使用一些简单的规则顺序添加到网格中,但是我无法确定这些规则可能是什么,或者它们如何可以防止最终形状出现任何空洞。
有谁知道这是如何工作的?
I've been trying to work out exactly how the TED Talk homepage works. Leaving aside all the animation rubbish, I find the way that the boxes are organised is really fascinating.
At first glance it looks like the jQuery masonry plugin, bu it quickly becomes clear that it tends to create several right angle triangle shapes, but has no fixed number of columns or rows, and the final shape produced is always completely solid (no hollow parts).
My initial assumption was that the boxes (their size is predetermined by some factor on the site) were sorted randomly and then sequentially added to the grid using a few simple rules, however I can't identify what those rules might be, or how they could prevent any hollows in the final shape.
Does anyone have any idea how this works?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
可能是错误的,但有一些观察结果:
对于给定部分 ,总是有 4(#1)。 (#2)、(#3) 和 (#4) 的数量可以是:
至于顺序:
Could be wrong but a few observations:
For a given section, there are always 4(#1). The number of (#2), (#3) and (#4) can be either:
As for the order:
下面是执行此操作的 javascript 代码(您需要一个带有
div#container
的 html 页面):Here is the javascript code which does it (you need a html page with a
div#container
):我想我已经解决了。
首先,项目数量差异很大,我当前查看的页面只有 13 个框。
首先,我将按从最大到最小的顺序将 4 种大小的块分别命名为:
A、B、C、D
正如我们所知,第一“行”包含两个 A 和两个垂直堆叠的 B,例如:
这些排列看起来是随机的,但 B 始终处于相同的垂直模式。刚才看这个我意识到只有两行,第二行的工作方式相同。
第二行的高度是第一行的两倍,占据页面的其余部分。它由水平堆叠的形状图案构成,这些形状图案(至少部分)是随机选择的。
我找到了 9 个这样的形状图案,其中两个是单个 A 或 B,其余的是:
下一个问题是如何选择这些图案?可能需要一些巧妙的搜索来找到最佳配置:例如,如果要显示 X 个项目,我们需要找到总共 X 个不超过行宽度的配置。
这可以通过图案密度的度量来完成,该度量是块的数量除以图案的宽度。
I think I've worked it out.
First of all the number of items varies substantially, I'm currently viewing a page with only 13 boxes.
To start I'll name each of the 4 sizes of blocks from largest to smallest as:
A,B,C,D
As we know the first 'row' contains two As and two vertical stacks of Bs, for example:
The arrangement of these appears to be random, but the Bs are always in the same vertical pattern. Looking at this just now I realised that there are only two rows, and the second row works in the same way.
The second row is twice the height of the first, taking up the rest of the page. It is built of horizontally stacked patterns of shapes, which are (at least in part) selected randomly.
I've found 9 of these patterns of shapes, two of which are a single A or B and the rest are:
The next question is how are these selected? There may be some clever searching to find the best configuration: for example if there are X items to be displayed we need to find a configuration with a total of X which does not exceed the width of the row.
This could be done with a metric of pattern density, which would be number of blocks divided by the width of the pattern.