# Discourse 下雪效果？

**URL:** https://meta.discourse.org/t/discourse-snowing-effect/135151
**Category:** UX
**Created:** [2019年十二月5日 13:10 UTC](https://meta.discourse.org/t/discourse-snowing-effect/135151 "2019-12-05T13:10:23Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![calebs](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/calebs/32/148838_2.png) [@calebs](https://meta.discourse.org/u/calebs)
#### Post date: [2019年十二月5日 13:10 UTC](https://meta.discourse.org/t/discourse-snowing-effect/135151/1 "2019-12-05T13:10:23Z")

</div>

我们目前正在为节日“装饰”我们的 Discourse 论坛。能否为论坛添加下雪效果？就像以前 WordPress 博客那样。🙂

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [2019年十二月5日 13:40 UTC](https://meta.discourse.org/t/discourse-snowing-effect/135151/2 "2019-12-05T13:40:47Z")

</div>

是的，这是可能的，但我不知道有哪个主题实现了这一点。不过，可以参考这个链接：[https://meta.discourse.org/t/christmas-hats-component/74853。](https://meta.discourse.org/t/christmas-hats-component/74853%E3%80%82)

---

<div class="post-metadata">

### Author: ![calebs](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/calebs/32/148838_2.png) [@calebs](https://meta.discourse.org/u/calebs)
#### Post date: [2019年十二月5日 14:30 UTC](https://meta.discourse.org/t/discourse-snowing-effect/135151/3 "2019-12-05T14:30:18Z")

</div>

我们使用帽子组件已经有一段时间了，不仅仅是在圣诞节。🙂 不过还是感谢。

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [2019年十二月5日 14:30 UTC](https://meta.discourse.org/t/discourse-snowing-effect/135151/4 "2019-12-05T14:30:57Z")

</div>

这是我尝试的一个项目——现在已发布在 GitHub 上：

> [@Winter snow theme component snowflake](https://meta.discourse.org/t/winter-snow-theme-component/135157?u=david):
>
> This theme component adds some animated snow to your forum. christmas_tree Warning: the animations will increase browser CPU usage santa[eye Demo](https://theme-creator.discourse.org/theme/david/snow)[link Repository](https://github.com/davidtaylorhq/discourse-snow-theme) Javascript mode (shared by @cjk77 [here](https://meta.discourse.org/t/discourse-snowing-effect/135151/6)): CSS Mode (adapted from [here](https://codemyui.com/falling-snowflake-background-animation-pure-css/))

---

<div class="post-metadata">

### Author: ![calebs](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/calebs/32/148838_2.png) [@calebs](https://meta.discourse.org/u/calebs)
#### Post date: [2019年十二月5日 14:32 UTC](https://meta.discourse.org/t/discourse-snowing-effect/135151/5 "2019-12-05T14:32:33Z")

</div>

这正是我们想要的！看起来太棒了，谢谢！

---

<div class="post-metadata">

### Author: ![cjk77](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cjk77/32/151779_2.png) [@cjk77](https://meta.discourse.org/u/cjk77)
#### Post date: [2019年十二月5日 14:42 UTC](https://meta.discourse.org/t/discourse-snowing-effect/135151/6 "2019-12-05T14:42:58Z")

</div>

我为我的论坛创建了万圣节和圣诞节的季节性主题组件。去年我使用了 CSS，但正如 David 指出的那样，它占用了大量 CPU 资源。今年，我改用了 JavaScript，取得了更好（也更美观）的效果——您可以在以下链接中看到它们：

[https://vgforums.net](https://vgforums.net)

我获取该脚本的 CodePen 链接在[这里](https://codepen.io/massiebn/pen/vmkwJ)

我只需将脚本放入新主题组件的 `<head>` 部分，然后——瞧！下雪了！

---

<div class="post-metadata">

### Author: ![calebs](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/calebs/32/148838_2.png) [@calebs](https://meta.discourse.org/u/calebs)
#### Post date: [2019年十二月5日 14:58 UTC](https://meta.discourse.org/t/discourse-snowing-effect/135151/7 "2019-12-05T14:58:13Z")

</div>

感谢分享，Chris。

另外，针对 David 的主题，为了降低 CPU 占用，我们移除了两个 .png 雪花文件。

在编辑 CSS 时：

```
background-image: url($s3);

```

我们还降低了速度和透明度，使其看起来更加柔和。再次感谢大家！

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [2019年十二月5日 15:00 UTC](https://meta.discourse.org/t/discourse-snowing-effect/135151/8 "2019-12-05T15:00:49Z")

</div>

我超喜欢这个，@cjk77。我已经更新了组件，现在有两个选项——默认的是你分享的那个基于 JavaScript 的版本：☃

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [2019年十二月6日 18:00 UTC](https://meta.discourse.org/t/discourse-snowing-effect/135151/9 "2019-12-06T18:00:12Z")

</div>

此主题在 27 小时后自动关闭。不再允许新回复。
