News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Snow Effect

Started by Fantom007, December 12, 2009, 04:27:20 AM

Previous topic - Next topic

smp420

In my sig is a demo of Antechinus's code
"Things turn out best for those who make the best of the way things turn out." -Jack Buck

searchgr

Quote from: Ha² on December 13, 2009, 11:00:31 PM

Find:
// Output any remaining HTML headers. (from mods, maybe?)
echo $context['html_headers'];

Replace with:


To 'replace' or to 'add after'?

b4pjoe

Quote from: searchgr on December 14, 2009, 06:59:03 AM
Quote from: Ha² on December 13, 2009, 11:00:31 PM

Find:
// Output any remaining HTML headers. (from mods, maybe?)
echo $context['html_headers'];

Replace with:


To 'replace' or to 'add after'?

The "Replace" code had those two line added to the end of it so a replace will keep those lines.

Spectrum..!!

Quote from: smp420 on December 14, 2009, 12:12:39 AM
I packaged up Antechinus code. If your using a custom theme install it in there with the package manager and then add the snow.js file to your scripts folder. I included another package for 1.1.x I couldn't test it as I have no 1.1.x site. but it should work. for 1.1.x snow.js goes in goes in your themes folder.

I tested on 2.0 RC2 and 1.1.11 demo forum (localhost) is working.

Thanks.

Existem pessoas que deixam de buscar algo que dura a vida toda, para somente conquistar algo que dura alguns momentos...
Ser humilde; não é ser menos que alguém. É saber que não somos mais que ninguém!
SMF 2.0.4 | Meu site -->
Dell Vostro 3560 + AMD Radeon™ HD 7670M 1GB| Windows 8 Pro | Fedora 18 | IE10 | Google Chrome

Não atendo PM para pedidos de suporte/ajuda

searchgr


searchgr

It doesn't look well on curve theme. The background is too much white....

Antechinus

Quote from: smp420 on December 14, 2009, 12:56:43 AM
In my sig is a demo of Antechinus's code

It isn't my code. I got it from Xarcell's old Christmas theme and he got it from Dynamic Drive.

mtdesign

I have tried stuff like this before and it turned out not to be a good thing. This tends to slow down peoples pages and lag their computers very bad. I think it looks awesome though but it has its downfalls as well.
I am a Linux bug!

smp420

Doesnt seem to slow my site down much if at all. And its only for a month anyways.
Quote from: searchgr on December 15, 2009, 03:27:18 PM
It doesn't look well on curve theme. The background is too much white....
Maybe somone can edit it so the snow is yellow. LOL
"Things turn out best for those who make the best of the way things turn out." -Jack Buck

Arantor

It's not the site it slows down. It slows down the entire browser in most cases which for users like me that have multiple browser tabs open, it can be awkward (though Chrome putting every tab as its own process mitigates that somewhat)

searchgr

Quote from: Nameless? on December 12, 2009, 02:56:21 PM
Demo = Here!  :)

This snow fall looks very good even for a white background forums. Do you know where can i place the code in the index.template.php?

Nick Whetstone

Quote from: searchgr on December 16, 2009, 11:22:11 AM
Quote from: Nameless? on December 12, 2009, 02:56:21 PM
Demo = Here!  :)

This snow fall looks very good even for a white background forums. Do you know where can i place the code in the index.template.php?
Code (Find) Select
<script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/script.js?rc2"></script>
Code (Replace that with) Select
<script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/script.js?rc2"></script>
   <script type="text/javascript" src="', $settings['theme_url'], '/scripts/snow.js">
   /***********************************************
   * Snow Effect without images-by Kurt Grigg at http://www.btinternet.com/~kurt.grigg/javascript
   * Script featured &amp; available at Dynamic Drive at http://www.dynamicdrive.com/
   * Please keep this notice intact
   ***********************************************/
   </script>


Assuming that the snow script is named snow.js and located at /Themes/yourthemehere/scripts/snow.js and that you're on RC2.
The artist formerly known as (Ha)²

Former Support Specialist

Please do not solicit support via PM. Here's why!

searchgr

You mean not to use the code that is given by the website?

Nick Whetstone

Quote from: searchgr on December 16, 2009, 03:39:56 PM
You mean not to use the code that is given by the website?
Hrmm? I'm not sure what you mean by that?
The artist formerly known as (Ha)²

Former Support Specialist

Please do not solicit support via PM. Here's why!

searchgr

Quote from: Nameless? on December 12, 2009, 02:56:21 PM
Demo = Here!  :)


<script>
// CREDITS: // Snowmaker Copyright (c) 2003 Peter Gehrig. All rights reserved.
// Distributed by http://www.hypergurl.com // Permission given to use the script
on webpages provided that this notice remains as is. // Set the number of snowflakes
(more than 30 - 40 not recommended) var snowmax=35 // Set the colors for the snow.
Add as many colors as you like var snowcolor=new Array("#aaaacc","#ddddFF","#ccccDD")
// Set the fonts, that create the snowflakes. Add as many fonts as you like var
snowtype=new Array("Arial Black","Arial Narrow","Times","Comic
Sans MS") // Set the letter that creates your snowflake (recommended:*) var
snowletter="*" // Set the speed of sinking (recommended values range
from 0.3 to 2) var sinkspeed=0.6 // Set the maximal-size of your snowflaxes var
snowmaxsize=22 // Set the minimal-size of your snowflaxes var snowminsize=8 //
Set the snowing-zone // Set 1 for all-over-snowing, set 2 for left-side-snowing
// Set 3 for center-snowing, set 4 for right-side-snowing var snowingzone=3 ///////////////////////////////////////////////////////////////////////////
// CONFIGURATION ENDS HERE ///////////////////////////////////////////////////////////////////////////
// Do not edit below this line var snow=new Array() var marginbottom var marginright
var timer var i_snow=0 var x_mv=new Array(); var crds=new Array(); var lftrght=new
Array(); var browserinfos=navigator.userAgent var ie5=document.all&&document.getElementById&&!browserinfos.match(/Opera/)
var ns6=document.getElementById&&!document.all var opera=browserinfos.match(/Opera/)
var browserok=ie5||ns6||opera function randommaker(range) { rand=Math.floor(range*Math.random())
return rand } function initsnow() { if (ie5 || opera) { marginbottom = document.body.clientHeight
marginright = document.body.clientWidth } else if (ns6) { marginbottom = window.innerHeight
marginright = window.innerWidth } var snowsizerange=snowmaxsize-snowminsize for
(i=0;i<=snowmax;i++) { crds[i] = 0; lftrght[i] = Math.random()*15; x_mv[i]
= 0.03 + Math.random()/10; snow[i]=document.getElementById("s"+i) snow[i].style.fontFamily=snowtype[randommaker(snowtype.length)]
snow[i].size=randommaker(snowsizerange)+snowminsize snow[i].style.fontSize=snow[i].size
snow[i].style.color=snowcolor[randommaker(snowcolor.length)] snow[i].sink=sinkspeed*snow[i].size/5
if (snowingzone==1) {snow[i].posx=randommaker(marginright-snow[i].size)} if (snowingzone==2)
{snow[i].posx=randommaker(marginright/2-snow[i].size)} if (snowingzone==3) {snow[i].posx=randommaker(marginright/2-snow[i].size)+marginright/4}
if (snowingzone==4) {snow[i].posx=randommaker(marginright/2-snow[i].size)+marginright/2}
snow[i].posy=randommaker(2*marginbottom-marginbottom-2*snow[i].size) snow[i].style.left=snow[i].posx
snow[i].style.top=snow[i].posy } movesnow() } function movesnow() { for (i=0;i<=snowmax;i++)
{ crds[i] += x_mv[i]; snow[i].posy+=snow[i].sink snow[i].style.left=snow[i].posx+lftrght[i]*Math.sin(crds[i]);
snow[i].style.top=snow[i].posy if (snow[i].posy>=marginbottom-2*snow[i].size
|| parseInt(snow[i].style.left)>(marginright-3*lftrght[i])){ if (snowingzone==1)
{snow[i].posx=randommaker(marginright-snow[i].size)} if (snowingzone==2) {snow[i].posx=randommaker(marginright/2-snow[i].size)}
if (snowingzone==3) {snow[i].posx=randommaker(marginright/2-snow[i].size)+marginright/4}
if (snowingzone==4) {snow[i].posx=randommaker(marginright/2-snow[i].size)+marginright/2}
snow[i].posy=0 } } var timer=setTimeout("movesnow()",50) } for (i=0;i<=snowmax;i++)
{ document.write("<span id='s"+i+"' style='position:absolute;top:-"+snowmaxsize+"'>"+snowletter+"</span>")
} if (browserok) { window.onload=initsnow } </script>

Nick Whetstone

Ah, yes. I was referring to the code Antechinus posted.
The artist formerly known as (Ha)²

Former Support Specialist

Please do not solicit support via PM. Here's why!

searchgr

If i choose the above code, do you know where (in the index.template php) i have to put it?

smp420

Just use the package I made its in the first page of this thread.

Quote from: mtdesign on December 16, 2009, 09:18:50 AM
Quote from: smp420 on December 15, 2009, 10:44:16 PM
Doesnt seem to slow my site down much if at all. And its only for a month anyways.
Quote from: searchgr on December 15, 2009, 03:27:18 PM
It doesn't look well on curve theme. The background is too much white....
Maybe somone can edit it so the snow is yellow. LOL


Doesn't really slow down your site but for some people who may have older computers it could freeze them up. The idea is a nice idea but it isn't always site friendly for some users because it lags their browser down. I edited the snow.js file so it should show yellow now but I haven't tested it so let me know if it doesn't for some reason. Im pretty sure the yellow snow was a joke but I did it just in case..lol
The yellow snow was a joke.
"Things turn out best for those who make the best of the way things turn out." -Jack Buck

OverWorked

If there is any chance what so ever that it would slow down my browser, I would ditch this effect. But I clicked on the demo and it seemed to work just fine, and the flakes are pretty small.

Around Thanksgiving I was a site that had falling leaves, and they kept obscuring the text I was trying to read. :(
Some times these "cute" effects are better left for someone else's forum. :)

Let it snow, let it show, let it snow!
I LOVE CHRISTMAS!

Arantor

Quote from: OverWorked on December 16, 2009, 06:14:43 PM
If there is any chance what so ever that it would slow down my browser, I would ditch this effect. But I clicked on the demo and it seemed to work just fine, and the flakes are pretty small.

It's not the size, it's the number. And it *will* slow down your browser, just not by a huge amount it seems.

Advertisement: