简体   繁体   English

棋盘格过渡仅使用CSS3吗?

[英]Checkerboard transition with CSS3 Only?

是否可以仅使用CSS 3创建棋盘格过渡类型?

If you wanted to do it with images (can't see how this would work with anything else), you could use a number of divs in a grid, all with the same background image, but with different background position so that it just looks like a normal image. 如果您想对图像进行处理(看不到其他方法如何工作),则可以在网格中使用多个div,这些div具有相同的背景图像,但背景位置不同,因此看起来像普通的图像一样。 You could then have another image behind that one by absolutely positioning them both. 然后,您可以通过绝对定位两个图像,在其后放置另一个图像。 You could then animate the opacity of each of the divs on the grid with different delays to get the checkerboard effect. 然后,您可以使用不同的延迟为网格上每个div的不透明度设置动画,以获得棋盘效果。

By using nth-child selectors you could change the delays for every other one, or something more complex. 通过使用第n个子选择器,您可以更改其他每个选择器的延迟,或者更复杂的延迟。

You'd likely want JS to then set the background image of the divs to the image behind them, and then remove the transition and set opacity to 1. You could then change the image behind to something new to checkerboard to that one. 您可能希望JS然后将div的背景图像设置为其后的图像,然后删除过渡并将不透明度设置为1。然后可以将其后的图像更改为该棋盘的新内容。

If you make this, please let me know – it sounds awesome! 如果您这样做,请告诉我-听起来很棒!

I don't understand what is 'transition' in your message. 我不明白您的邮件中的“转换”是什么。 But you can draw a checkerboard with only css3. 但是您可以仅使用css3绘制棋盘。 Look at this : http://lea.verou.me/css3patterns/ 看看这个: http : //lea.verou.me/css3patterns/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM