TinyPortal

Development => Block Codes => Topic started by: Xarcell on November 19, 2005, 02:02:23 AM

Title: X-mas Snow Effect
Post by: Xarcell on November 19, 2005, 02:02:23 AM
I come up with a way to add a snow effect. Simple, but complicated.

I created a center block and added the "2" following javascript codes:


<script type="text/javascript">

/******************************************
* Snow Effect Script- By Altan d.o.o. (http://www.altan.hr/snow/index.html)
* Visit Dynamic Drive DHTML code library (http://www.dynamicdrive.com/) for full source code
* Last updated Nov 9th, 05' by DD. This notice must stay intact for use
******************************************/
 
  //Configure below to change URL path to the snow image
  var snowsrc="seasons/snowflake_6.gif"
  // Configure below to change number of snow to render
  var no = 15;
  // Configure whether snow should disappear after x seconds (0=never):
  var hidesnowtime = 0;
  // Configure how much snow should drop down before fading ("windowheight" or "pageheight")
  var snowdistance = "pageheight";

///////////Stop Config//////////////////////////////////

  var ie4up = (document.all) ? 1 : 0;
  var ns6up = (document.getElementById&&!document.all) ? 1 : 0;

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

  var dx, xp, yp;    // coordinate and position variables
  var am, stx, sty;  // amplitude and step variables
  var i, doc_width = 800, doc_height = 600;
 
  if (ns6up) {
    doc_width = self.innerWidth;
    doc_height = self.innerHeight;
  } else if (ie4up) {
    doc_width = iecompattest().clientWidth;
    doc_height = iecompattest().clientHeight;
  }

  dx = new Array();
  xp = new Array();
  yp = new Array();
  am = new Array();
  stx = new Array();
  sty = new Array();
  snowsrc=(snowsrc.indexOf("dynamicdrive.com")!=-1)? "snow.gif" : snowsrc
  for (i = 0; i < no; ++ i) { 
    dx[i] = 0;                        // set coordinate variables
    xp[i] = Math.random()*(doc_width-50);  // set position variables
    yp[i] = Math.random()*doc_height;
    am[i] = Math.random()*20;         // set amplitude variables
    stx[i] = 0.02 + Math.random()/10; // set step variables
    sty[i] = 0.7 + Math.random();     // set step variables
if (ie4up||ns6up) {
      if (i == 0) {
        document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><a href=\"http://dynamicdrive.com\"><img src='"+snowsrc+"' border=\"0\"><\/a><\/div>");
      } else {
        document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><img src='"+snowsrc+"' border=\"0\"><\/div>");
      }
    }
  }

  function snowIE_NS6() {  // IE and NS6 main animation function
    doc_width = ns6up?window.innerWidth-10 : iecompattest().clientWidth-10;
doc_height=(window.innerHeight && snowdistance=="windowheight")? window.innerHeight : (ie4up && snowdistance=="windowheight")?  iecompattest().clientHeight : (ie4up && !window.opera && snowdistance=="pageheight")? iecompattest().scrollHeight : iecompattest().offsetHeight;
    for (i = 0; i < no; ++ i) {  // iterate for every dot
      yp[i] += sty[i];
      if (yp[i] > doc_height-50) {
        xp[i] = Math.random()*(doc_width-am[i]-30);
        yp[i] = 0;
        stx[i] = 0.02 + Math.random()/10;
        sty[i] = 0.7 + Math.random();
      }
      dx[i] += stx[i];
      document.getElementById("dot"+i).style.top=yp[i]+"px";
      document.getElementById("dot"+i).style.left=xp[i] + am[i]*Math.sin(dx[i])+"px"; 
    }
    snowtimer=setTimeout("snowIE_NS6()", 10);
  }

function hidesnow(){
if (window.snowtimer) clearTimeout(snowtimer)
for (i=0; i<no; i++) document.getElementById("dot"+i).style.visibility="hidden"
}


if (ie4up||ns6up){
    snowIE_NS6();
if (hidesnowtime>0)
setTimeout("hidesnow()", hidesnowtime*1000)
}

</script>



<script type="text/javascript" src="seasons/snow.js">

/***********************************************
* Snow Effect without images-by Kurt Grigg at http://www.btinternet.com/~kurt.grigg/javascript
* Script featured & available at Dynamic Drive at http://www.dynamicdrive.com/
* Please keep this notice intact
***********************************************/

</script>


<table width="100% border="0" cellpadding="0" cellspacing="0" bgcolor="#ffffff">
<tr>
<td align="center"><img src="seasons/merry_christmas.jpg">
</td>
</tr>
</table>
<br>



Unzip the attachement and upload your forum directory.

I intend to add more stuff to this soon, such as images, leaves for fall, and whatever else I can come up with. You can also edit the javascript code change speed, number of flakes, etc...

Note: I did not write this code. It was wriiten by 2 different people for different effects. I put the 2 codes together for a more natural effect. However, it does show some lag at times.

You can see an demo here:

www.xarcell.com

-Xarcell

[attachment deleted by admin]
Title: Re: X-mas Snow Effect
Post by: mastroale on December 04, 2005, 11:31:21 AM
Great nice effetc! Look in your code, that in lasts rows we have to have a </table> instead of <table>. This causes tinyportal right column to fall under the center block  ;)
Ale.
Title: Re: X-mas Snow Effect
Post by: IchBin on December 04, 2005, 08:20:45 PM
Fixed! :)
Title: Re: X-mas Snow Effect
Post by: xtremecruiser on December 16, 2005, 09:34:27 PM
That is kinda cool.  Would really annoy my members :2funny: I think I will add it for the week of X-Mas

Now the theme Daze & Stealth Skin by Diplomat & Xarcell is nice too :o
Title: Re: X-mas Snow Effect
Post by: HiroshimaPriest on December 20, 2005, 09:56:05 AM
Thanks,

I just popped it in place....will make a nice touch for the next couple weeks.  ;)
Title: Re: X-mas Snow Effect
Post by: Klozi on January 02, 2006, 07:44:43 PM
Nice effect, but it slows down the performance.
Title: Re: X-mas Snow Effect
Post by: dennishe on November 07, 2006, 12:06:43 PM
'tis the season again, soon - thanks for this li'l thing :)


Dennis
Title: Re: X-mas Snow Effect
Post by: Vinspire on November 07, 2006, 01:55:31 PM
Its awesome. Thank you ! :)
Title: Re: X-mas Snow Effect
Post by: knat on November 07, 2006, 06:18:07 PM
Nice snippet  ;)

However this is the one i use in a center script block:

<script type="text/javascript">

/******************************************
* Snow Effect Script- By Altan d.o.o. (http://www.altan.hr/snow/index.html)
* Visit Dynamic Drive DHTML code library (http://www.dynamicdrive.com/) for full source code
* Last updated Nov 9th, 05' by DD. This notice must stay intact for use
******************************************/
 
  //Configure below to change URL path to the snow image
  var snowsrc="snow.gif"
  // Configure below to change number of snow to render
  var no = 10;
  // Configure whether snow should disappear after x seconds (0=never):
  var hidesnowtime = 0;
  // Configure how much snow should drop down before fading ("windowheight" or "pageheight")
  var snowdistance = "pageheight";

///////////Stop Config//////////////////////////////////

  var ie4up = (document.all) ? 1 : 0;
  var ns6up = (document.getElementById&&!document.all) ? 1 : 0;

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

  var dx, xp, yp;    // coordinate and position variables
  var am, stx, sty;  // amplitude and step variables
  var i, doc_width = 800, doc_height = 600;
 
  if (ns6up) {
    doc_width = self.innerWidth;
    doc_height = self.innerHeight;
  } else if (ie4up) {
    doc_width = iecompattest().clientWidth;
    doc_height = iecompattest().clientHeight;
  }

  dx = new Array();
  xp = new Array();
  yp = new Array();
  am = new Array();
  stx = new Array();
  sty = new Array();
  snowsrc=(snowsrc.indexOf("dynamicdrive.com")!=-1)? "snow.gif" : snowsrc
  for (i = 0; i < no; ++ i) { 
    dx[i] = 0;                        // set coordinate variables
    xp[i] = Math.random()*(doc_width-50);  // set position variables
    yp[i] = Math.random()*doc_height;
    am[i] = Math.random()*20;         // set amplitude variables
    stx[i] = 0.02 + Math.random()/10; // set step variables
    sty[i] = 0.7 + Math.random();     // set step variables
if (ie4up||ns6up) {
      if (i == 0) {
        document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><a href=\"http://dynamicdrive.com\"><img src='"+snowsrc+"' border=\"0\"><\/a><\/div>");
      } else {
        document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><img src='"+snowsrc+"' border=\"0\"><\/div>");
      }
    }
  }

  function snowIE_NS6() {  // IE and NS6 main animation function
    doc_width = ns6up?window.innerWidth-10 : iecompattest().clientWidth-10;
doc_height=(window.innerHeight && snowdistance=="windowheight")? window.innerHeight : (ie4up && snowdistance=="windowheight")?  iecompattest().clientHeight : (ie4up && !window.opera && snowdistance=="pageheight")? iecompattest().scrollHeight : iecompattest().offsetHeight;
    for (i = 0; i < no; ++ i) {  // iterate for every dot
      yp[i] += sty[i];
      if (yp[i] > doc_height-50) {
        xp[i] = Math.random()*(doc_width-am[i]-30);
        yp[i] = 0;
        stx[i] = 0.02 + Math.random()/10;
        sty[i] = 0.7 + Math.random();
      }
      dx[i] += stx[i];
      document.getElementById("dot"+i).style.top=yp[i]+"px";
      document.getElementById("dot"+i).style.left=xp[i] + am[i]*Math.sin(dx[i])+"px"; 
    }
    snowtimer=setTimeout("snowIE_NS6()", 10);
  }

function hidesnow(){
if (window.snowtimer) clearTimeout(snowtimer)
for (i=0; i<no; i++) document.getElementById("dot"+i).style.visibility="hidden"
}


if (ie4up||ns6up){
    snowIE_NS6();
if (hidesnowtime>0)
setTimeout("hidesnow()", hidesnowtime*1000)
}

</script>


(https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fwww.gapeindex.dk%2Fsnow.gif&hash=344a8aca5302ace3189a5579c514def48316ee41) <-- put this snowflake into your root directory !

Demo: http://www.gapeindex.dk/index.php?page=20 (Warning: nudity)

Found the script here: http://www.dynamicdrive.com/dynamicindex3/snow.htm[/s]

Edit: I see now that its the same script as yours just without the second script. Why would you want to use both scripts together ? I had a hard time opening your page so i didnt see your demo.  :-\
Title: Re: X-mas Snow Effect
Post by: RoarinRow on November 07, 2006, 06:21:01 PM
Doh! my work blocked www.xarcell.com and knat's I won't bother clicking (yet)   ::)
Title: Re: X-mas Snow Effect
Post by: Ken. on November 07, 2006, 06:49:20 PM
Works great on my site.  :up:
I'll leave it turned on for a couple of hours in case someone wants to look.

Did Xarcell (or anyone else) ever add code for other hollidays like Thanksgiving, or whatever???


EDIT: sorry... heres the link (http://www.mykimbrell.com/FamilyForum/index.php)
Title: Re: X-mas Snow Effect
Post by: RoarinRow on November 07, 2006, 06:53:57 PM
Quote from: ken.kimbrell on November 07, 2006, 06:49:20 PM
Works great on my site.  :up:
I'll leave it turned on for a couple of hours in case someone wants to look.

Did Xarcell (or anyone else) ever add code for other hollidays like Thanksgiving, or whatever???


EDIT: sorry... heres the link (http://www.mykimbrell.com/FamilyForum/index.php)

Ahhh, very nice.  I'll have to remember this snippet for next month   :up:
Title: Re: X-mas Snow Effect
Post by: Ken. on November 07, 2006, 06:59:53 PM
Just changed out the Santa for a Turkey... looks a little more in tune with the current season!  :coolsmiley:
Title: Re: X-mas Snow Effect
Post by: knat on November 07, 2006, 07:16:08 PM
ahh now i see what the other script is for.. looks real good  ;)
Title: Re: X-mas Snow Effect
Post by: Vinspire on November 25, 2006, 06:02:50 PM
Awesome ! Working great ;)
Title: Re: X-mas Snow Effect
Post by: Ronlx2 on December 22, 2006, 12:10:40 AM
I think this is a great idea just couldn't get it to completely work without errors on any of my 5 forums. It would run but only the tiny snowflakes are visible not the big ones.

I have seen it work on some of the forum links here so what am I missing in not getting the big snowflakes? And are any of you get an error with TP9.6 on line 124 and an error with TP9.7 on line 135?
Title: Re: X-mas Snow Effect
Post by: G6Cad on December 22, 2006, 09:26:03 AM
look so you have the correct permissions to the seasons folder and the files in it, if the images are uploaded correct i the folders, and also that you placed the folder UNDER the forum directory so the paths are correct.
Title: Re: X-mas Snow Effect
Post by: bluedevil on December 22, 2006, 10:33:34 PM
I love it. 

See it in action here (http://midwestavalancheclub.com/index.php)
Title: Re: X-mas Snow Effect
Post by: RoarinRow on December 22, 2006, 10:42:06 PM
Quote from: bluedevil on December 22, 2006, 10:33:34 PM
I love it. 

See it in action here (http://midwestavalancheclub.com/index.php)

Lookin good Mick!   :up:
Title: Re: X-mas Snow Effect
Post by: JCphotog on December 26, 2006, 06:22:34 PM
I used this on the 25th.  I got complements!  Thank you!  Any thoughts on a java fire works display for the new year? 
Title: Re: X-mas Snow Effect
Post by: Vinspire on December 27, 2006, 03:06:47 PM
Quote from: JCphotog on December 26, 2006, 06:22:34 PM
I used this on the 25th.  I got complements!  Thank you!  Any thoughts on a java fire works display for the new year? 

Good Idea.

Anyway, how do i include this codes into the theme instead of having it on the block snippet ? edit the index.template.php ?
Title: Re: X-mas Snow Effect
Post by: G6Cad on December 27, 2006, 03:32:07 PM
Yes, for every theme in use.
There is some other post in here with kust the javacode to add in to the index.tamplate.php (just one string and a file to place in the root for the forum)
Title: Re: X-mas Snow Effect
Post by: Vinspire on December 28, 2006, 09:02:34 AM
Quote from: G6 on December 27, 2006, 03:32:07 PM
Yes, for every theme in use.
There is some other post in here with kust the javacode to add in to the index.tamplate.php (just one string and a file to place in the root for the forum)

Thanks G6. :)
Title: Re: X-mas Snow Effect
Post by: JOSHSKORN on September 09, 2007, 11:39:07 AM
Sorry I can't seem to find the mentioned download for this file.   Can someone get it for me?

Also, any chance of a flashy lightning script?
Title: Re: X-mas Snow Effect
Post by: Zetan on September 09, 2007, 11:42:31 AM
Quote from: JOSHSKORN on September 09, 2007, 11:39:07 AM
Sorry I can't seem to find the mentioned download for this file.   Can someone get it for me?

It's an attachment, in the very first post.
Title: Re: X-mas Snow Effect
Post by: JOSHSKORN on September 09, 2007, 11:48:44 AM
Quote from: Zetan on September 09, 2007, 11:42:31 AM
Quote from: JOSHSKORN on September 09, 2007, 11:39:07 AM
Sorry I can't seem to find the mentioned download for this file.   Can someone get it for me?

It's an attachment, in the very first post.

Duh...OK can you tell I've been working just a little too hard on my website? lol I'm going blind.

Anyway, would still be cool to get some sort of lightning effect for this...not just one cheesy lightning bolt.
Title: Re: X-mas Snow Effect
Post by: pass25 on November 11, 2007, 02:17:29 AM
Hi,

Im new in smf, and i dont now here to put the code:

Quote<script type="text/javascript">

/******************************************
* Snow Effect Script- By Altan d.o.o. (http://www.altan.hr/snow/index.html)
* Visit Dynamic Drive DHTML code library (http://www.dynamicdrive.com/) for full source code
* Last updated Nov 9th, 05' by DD. This notice must stay intact for use
******************************************/
 
  //Configure below to change URL path to the snow image
  var snowsrc="seasons/snowflake_6.gif"
  // Configure below to change number of snow to render
  var no = 15;
  // Configure whether snow should disappear after x seconds (0=never):
  var hidesnowtime = 0;
  // Configure how much snow should drop down before fading ("windowheight" or "pageheight")
  var snowdistance = "pageheight";

///////////Stop Config//////////////////////////////////

  var ie4up = (document.all) ? 1 : 0;
  var ns6up = (document.getElementById&&!document.all) ? 1 : 0;

   function iecompattest(){
   return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
   }

  var dx, xp, yp;    // coordinate and position variables
  var am, stx, sty;  // amplitude and step variables
  var i, doc_width = 800, doc_height = 600;
 
  if (ns6up) {
    doc_width = self.innerWidth;
    doc_height = self.innerHeight;
  } else if (ie4up) {
    doc_width = iecompattest().clientWidth;
    doc_height = iecompattest().clientHeight;
  }

  dx = new Array();
  xp = new Array();
  yp = new Array();
  am = new Array();
  stx = new Array();
  sty = new Array();
  snowsrc=(snowsrc.indexOf("dynamicdrive.com")!=-1)? "snow.gif" : snowsrc
  for (i = 0; i < no; ++ i) { 
    dx = 0;                        // set coordinate variables
    xp = Math.random()*(doc_width-50);  // set position variables
    yp = Math.random()*doc_height;
    am = Math.random()*20;         // set amplitude variables
    stx = 0.02 + Math.random()/10; // set step variables
    sty = 0.7 + Math.random();     // set step variables
      if (ie4up||ns6up) {
      if (i == 0) {
        document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><a href=\"http://dynamicdrive.com\"><img src='"+snowsrc+"' border=\"0\"><\/a><\/div>");
      } else {
        document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><img src='"+snowsrc+"' border=\"0\"><\/div>");
      }
    }
  }

  function snowIE_NS6() {  // IE and NS6 main animation function
    doc_width = ns6up?window.innerWidth-10 : iecompattest().clientWidth-10;
      doc_height=(window.innerHeight && snowdistance=="windowheight")? window.innerHeight : (ie4up && snowdistance=="windowheight")?  iecompattest().clientHeight : (ie4up && !window.opera && snowdistance=="pageheight")? iecompattest().scrollHeight : iecompattest().offsetHeight;
    for (i = 0; i < no; ++ i) {  // iterate for every dot
      yp += sty;
      if (yp > doc_height-50) {
        xp = Math.random()*(doc_width-am-30);
        yp = 0;
        stx = 0.02 + Math.random()/10;
        sty = 0.7 + Math.random();
      }
      dx += stx;
      document.getElementById("dot"+i).style.top=yp+"px";
      document.getElementById("dot"+i).style.left=xp + am*Math.sin(dx)+"px"; 
    }
    snowtimer=setTimeout("snowIE_NS6()", 10);
  }

   function hidesnow(){
      if (window.snowtimer) clearTimeout(snowtimer)
      for (i=0; i<no; i++) document.getElementById("dot"+i).style.visibility="hidden"
   }
      

if (ie4up||ns6up){
    snowIE_NS6();
      if (hidesnowtime>0)
      setTimeout("hidesnow()", hidesnowtime*1000)
      }

</script>



<script type="text/javascript" src="seasons/snow.js">

/***********************************************
* Snow Effect without images-by Kurt Grigg at http://www.btinternet.com/~kurt.grigg/javascript
* Script featured & available at Dynamic Drive at http://www.dynamicdrive.com/
* Please keep this notice intact
***********************************************/

</script>


<table width="100% border="0" cellpadding="0" cellspacing="0" bgcolor="#ffffff">
<tr>
<td align="center"><img src="seasons/merry_christmas.jpg">
</td>
</tr>
</table>


Is in index.themplate.php?

Tnaks.
Title: Re: X-mas Snow Effect
Post by: Zetan on November 11, 2007, 02:21:20 AM
Quote from: Xarcell on November 19, 2005, 02:02:23 AM


I created a center block and added the "2" following javascript codes:




Unzip the attachement and upload your forum directory.



-Xarcell

The instructions are in the first post. No need to touch the index template file.
Upload the image, paste the code into a Center Block.
Title: Re: X-mas Snow Effect
Post by: pass25 on November 11, 2007, 02:24:15 AM
Hi,
Thanks friend!

Title: Re: X-mas Snow Effect
Post by: Zetan on November 11, 2007, 02:25:00 AM
No problem  :)

[edit] Sheesh.. another Christmas coming. Jesus should have been born on a Leap Year.
Title: Re: X-mas Snow Effect
Post by: awyett on December 02, 2007, 01:49:36 PM
hello, can somebody help me? What part of which script do i change so the snow doesn't go so far to the right of the page that a scrollbar appears? thanks in advance
Title: Re: X-mas Snow Effect
Post by: awyett on December 02, 2007, 02:26:36 PM
...or to just disable the the scrollbar that goes accross...
Title: Re: X-mas Snow Effect
Post by: G6Cad on December 02, 2007, 04:01:20 PM
Ask on the dynamicscript site where the code comes from.
Title: Re: X-mas Snow Effect
Post by: awyett on December 02, 2007, 04:47:53 PM
okay, thanks
Title: Re: X-mas Snow Effect
Post by: jdvarner on December 02, 2007, 11:41:34 PM
Xarcell, thanks this is very cool. Just asking, can it be made to only appear on the home page and not while folks are playing the arcade. Doesnt affect the game, it just locks up the arcade for few.
Title: Re: X-mas Snow Effect
Post by: radel on December 03, 2007, 01:36:42 AM
I found another snow script in Dynamic Drive (http://www.dynamicdrive.com/dynamicindex3/snownoimages.htm) which doesnt use any images. It works best with a dark background.


This is what i did. I used the Global Headers and Footers mod found HERE (http://custom.simplemachines.org/mods/index.php?mod=351), and I inserted the following code into the headers section.
<script type="text/javascript" src="snow.js">

/***********************************************
* Snow Effect without images-by Kurt Grigg at http://www.btinternet.com/~kurt.grigg/javascript
* Script featured & available at Dynamic Drive at http://www.dynamicdrive.com/
* Please keep this notice intact
***********************************************/

</script>




Then

I saved the following as snow.js
(You can download the file from here (http://www.dynamicdrive.com/dynamicindex3/snownoimages.htm)).

//Snow - http://www.btinternet.com/~kurt.grigg/javascript

if  ((document.getElementById) &&
window.addEventListener || window.attachEvent){

(function(){

//Configure here.

var num = 30;   //Number of flakes
var timer = 30; //setTimeout speed. Varies on different comps
var enableinNS6 = 1 //Enable script in NS6/Mozilla? Snow animation could be slow in those browsers. (1=yes, 0=no).

//End.

var y = [];
var x = [];
var fall = [];
var theFlakes = [];
var sfs = [];
var step = [];
var currStep = [];
var h,w,r;
var d = document;
var pix = "px";
var domWw = (typeof window.innerWidth == "number");
var domSy = (typeof window.pageYOffset == "number");
var idx = d.getElementsByTagName('div').length;

if (d.documentElement.style &&
typeof d.documentElement.style.MozOpacity == "string")
num = 12;

for (i = 0; i < num; i++){
sfs[i] = Math.round(1 + Math.random() * 1);

document.write('<div id="flake'+(idx+i)+'" style="position:absolute;top:0px;left:0px;width:'
+sfs[i]+'px;height:'+sfs[i]+'px;background-color:#ffffff;font-size:'+sfs[i]+'px"><\/div>');

currStep[i] = 0;
fall[i] = (sfs[i] == 1)?
Math.round(2 + Math.random() * 2): Math.round(3 + Math.random() * 2);
step[i] = (sfs[i] == 1)?
0.05 + Math.random() * 0.1 : 0.05 + Math.random() * 0.05 ;
}


if (domWw) r = window;
else{
  if (d.documentElement &&
  typeof d.documentElement.clientWidth == "number" &&
  d.documentElement.clientWidth != 0)
  r = d.documentElement;
else{
  if (d.body &&
  typeof d.body.clientWidth == "number")
  r = d.body;
}
}


function winsize(){
var oh,sy,ow,sx,rh,rw;
if (domWw){
  if (d.documentElement && d.defaultView &&
  typeof d.defaultView.scrollMaxY == "number"){
  oh = d.documentElement.offsetHeight;
  sy = d.defaultView.scrollMaxY;
  ow = d.documentElement.offsetWidth;
  sx = d.defaultView.scrollMaxX;
  rh = oh-sy;
  rw = ow-sx;
}
else{
  rh = r.innerHeight;
  rw = r.innerWidth;
}
h = rh - 2; 
w = rw - 2;
}
else{
h = r.clientHeight - 2;
w = r.clientWidth - 2;
}
}


function scrl(yx){
var y,x;
if (domSy){
y = r.pageYOffset;
x = r.pageXOffset;
}
else{
y = r.scrollTop;
x = r.scrollLeft;
}
return (yx == 0)?y:x;
}


function snow(){
var dy,dx;

for (i = 0; i < num; i++){
dy = fall[i];
dx = fall[i] * Math.cos(currStep[i]);

y[i]+=dy;
x[i]+=dx;

if (x[i] >= w || y[i] >= h){
  y[i] = -10;
  x[i] = Math.round(Math.random() * w);
  fall[i] = (sfs[i] == 1)?
  Math.round(2 + Math.random() * 2): Math.round(3 + Math.random() * 2);
  step[i] = (sfs[i] == 1)?
  0.05 + Math.random() * 0.1 : 0.05 + Math.random() * 0.05 ;
}

theFlakes[i].top = y[i] + scrl(0) + pix;
theFlakes[i].left = x[i] + scrl(1) + pix;

currStep[i]+=step[i];
}
setTimeout(snow,timer);
}


function init(){
winsize();
for (i = 0; i < num; i++){
theFlakes[i] = document.getElementById("flake"+(idx+i)).style;
y[i] = Math.round(Math.random()*h);
x[i] = Math.round(Math.random()*w);
}
snow();
}


if (window.addEventListener){
window.addEventListener("resize",winsize,false);
window.addEventListener("load",init,false);

else if (window.attachEvent){
window.attachEvent("onresize",winsize);
window.attachEvent("onload",init);
}

})();
}//End.


I then uploaded the snow.js file into the root folder of my forum.

Here is the Dynamic Drive Demo (http://www.dynamicdrive.com/dynamicindex3/snowdemo.htm).
Here is the result in my site (http://irac.pcriot.com).

Title: Re: X-mas Snow Effect
Post by: william777 on December 03, 2007, 09:40:12 AM
Quote from: radel on December 03, 2007, 01:36:42 AM

I just pasted the first code into the headers using the Global Headers and Footers mod, and it worked just fine.


radel, can you please elaborate.
Title: Re: X-mas Snow Effect
Post by: radel on December 04, 2007, 11:27:55 AM
@william, edited my post above.....
Title: Re: X-mas Snow Effect
Post by: william777 on December 04, 2007, 12:35:05 PM
Thanks for your help.
Title: Re: X-mas Snow Effect
Post by: Xarcell on December 04, 2007, 12:55:17 PM
Quote from: awyett on December 02, 2007, 01:49:36 PM
hello, can somebody help me? What part of which script do i change so the snow doesn't go so far to the right of the page that a scrollbar appears? thanks in advance

It shouldn't do that, but if it does, then lessen the number of flakes in the snow.js file. The default is 30, try 15 instead.
Title: Re: X-mas Snow Effect
Post by: roco on December 06, 2007, 12:06:16 AM
Hi All! :)

hehe I have this script from many years.. no autor found on the top.. so.., butt you can take from oryginal..

And I write one line code:

<script language="JavaScript" type="text/javascript" src="', $settings['default_theme_url'], '/snow.js"></script>

..before "</body></html>..

For example default Theme:

Before:

// The following will be used to let the user know that some AJAX process is running
echo '
<div id="ajax_in_progress" style="display: none;', $context['browser']['is_ie'] && !$context['browser']['is_ie7'] ? 'position: absolute;' : '', '">', $txt['ajax_in_progress'], '</div>
';
// TinyPortal
     if($context['TPortal']['fixed_width']!=0)
             echo '</td></tr></table>';
// end
echo '
//< - hier come the script, only one line..
</body></html>';
}


After with the one line code..:

// The following will be used to let the user know that some AJAX process is running
echo '
<div id="ajax_in_progress" style="display: none;', $context['browser']['is_ie'] && !$context['browser']['is_ie7'] ? 'position: absolute;' : '', '">', $txt['ajax_in_progress'], '</div>
';
// TinyPortal
     if($context['TPortal']['fixed_width']!=0)
             echo '</td></tr></table>';
// end
echo '
<script language="JavaScript" type="text/javascript" src="', $settings['default_theme_url'], '/snow.js"></script>
</body></html>';
}


And you mast copy "snow.js" in to ../Themes/default/ -> here!

And you can write so.. in every Theme.. :)

I have diferent snow image: (https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fricoroco.com%2Fforum%2FThemes%2Fdefault%2Ft_snow.gif&hash=10c33f4f4b31fad0c4bb9ef70031f78580f79997) and this script from me, show - thise "snow image" direct from me.. butt its ok :)

For the efect can You look here in my forum: http://ricoroco.com/forum or on test subdomain for my TinyPortal here: http://tp.ricoroco.com/index.php?theme=66 and choose Theme: "TPstyle_11" where is the efect..

In the Attach ist complete..

cheers ;)
roco
Title: Re: X-mas Snow Effect
Post by: Xarcell on December 06, 2007, 12:34:15 AM
I'm not sure that script works in Firefox.
Title: Re: X-mas Snow Effect
Post by: roco on December 06, 2007, 01:09:16 AM
hehe upss..

fact, I have now tested and ..no way! in FF not work, wont a fix..
ok really sorry, I wona only help, butt I have not proov ok can You forgot..
I'm sorry, bat I have no time for write fix for this! I must go to another server machine and I'm 20h/day by my comp hehe

Okay, next time I look for better script.. Thank's & Sorry for All :]

roco

EDIT:

..butt hehe I have the fix..   O0

I taked from oryginal (Dinamic Drive..) + is my snow.gif and little rewrite + speed config in the script! Please change only the "snow.js"

I have proov under FireFox and is realy OK!  :up:

Look here now wiht fix: http://tp.ricoroco.com/index.php?theme=66

And in the Attach is the FIX (only new javascript: "snow.js")

Now is much better and go under FireFox to.., and I thank You! ;)

roco

.
Title: Re: X-mas Snow Effect
Post by: keith021773 on December 06, 2007, 01:56:36 AM
I use firefox 2.0.0.11 and it worked..  I saw the snow falling.
Title: Re: X-mas Snow Effect
Post by: G6Cad on December 06, 2007, 04:29:21 PM
Yes it's falling, but it's not fitted within the screen so you get scrollbars when it fall down to the bottom of the page
Title: Re: X-mas Snow Effect
Post by: roco on December 06, 2007, 04:47:44 PM
Hi! :)

And whats a browser have You?

OK. Can You tested ins the script - config.. for example:

After the "Stop Config":
///////////Stop Config//////////////////////////////////

  var ie4up = (document.all) ? 1 : 0;
  var ns6up = (document.getElementById&&!document.all) ? 1 : 0;

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

  var dx, xp, yp;    // coordinate and position variables
  var am, stx, sty;  // amplitude and step variables
  var i, doc_width = 800, doc_height = 600;


Maby can You test "var i, doc_width = 770, doc_height = 570;"
Maby You have small display?

And maby You can prooven in this config:

// Configure how much snow should drop down before fading ("windowheight" or "pageheight")
  var snowdistance = "pageheight";
  //Configure the speed - more is slower!
  var speed = 30

///////////Stop Config//////////////////////////////////



..to -> var snowdistance = "windowheight";

Well I see scrollbar only in small window.. and maby its small problem? :)

roco

.

EDIT

Is that posible, You have mor place after: theme_copyright(), ' <br />', tportal_version() , or to many <br />
Can You tested this line code write not befor </body></html> -> so only after:
</head><body>... ?

..or here:

...
<a href="http://jigsaw.w3.org/css-validator/check/referer" target="_blank"><img id="valid-css" src="', $settings['images_url'], '/valid-css.gif" alt="', $txt['valid_css'], '" width="54" height="20" style="margin: 5px 16px;" onmouseover="smfFooterHighlight(this, true);" onmouseout="smfFooterHighlight(this, false);" /></a>
</td>
</tr>
</table>
<script language="JavaScript" type="text/javascript" src="', $settings['default_theme_url'], '/snow.js"></script>
';
Title: Re: X-mas Snow Effect
Post by: Crip on December 06, 2007, 07:04:15 PM
Cool but isn't snow White..lol. :D
Title: Re: X-mas Snow Effect
Post by: roco on December 06, 2007, 10:17:45 PM
(https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fpoligon.ricoroco.com%2Ftesty%2Fphotohost%2Fuploads%2Fd9297e502d.jpg&hash=e93dd203739bac4d2d57e0331c3b71efba9f61ef)

Yeah! Now You have me! lol (https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fdchubfilmy-forum.homeip.net%2FSmileys%2Fclassic%2Fsanta_cheesy.gif&hash=4aab68206518672042cfdd61bf7c0c66c7e7c4f4)

..butt what whit the people who have'nt dark background, or wont another color, or grafik?

A maby so?: (https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fwww.bestoflife-macau.com%2Fimages%2Fcomponent%2Fsnow.gif&hash=96668976b1676fd253eb1aacb66676dc23c56ccf) (https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fzib.lutsk.ua%2Fsnow.gif&hash=f7f53e9a1463f57db3ea71a185f32f56b6edf5ce) (https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fwintergame.abv.bg%2Fi%2Fsnow.gif&hash=382d3ca081c0c80fa5c30c56ae5061c452ceb2a3) (https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fwww.climattorg.ru%2Fimg%2Fsnow.gif&hash=d0a151584fb2b1a3da70750743dcf5ccf2f63d74) (https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fwww.spacepimping.com%2Fimages%2Fsnow.gif&hash=b113ce6d04e535a660fda15410ad2681add7383a) (https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fs169.photobucket.com%2Falbums%2Fu207%2Fwckaze%2Fth_snowflake.gif&hash=a24aa90ffdc47ec0782573ac1ebc254106783588) (https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Flove.youthwant.com.tw%2F11%2Fimage%2Fsnow.gif&hash=2bf1261bb7bcdb309ca6fb67b88ea0cca2be48df)

In the script, on top section whit config ist:

******************************************/
 
  //Configure below to change URL path to the snow image
  var snowsrc="http://ricoroco.com/forum/Themes/default/t_snow.gif"


And this is from me, You can copy another image in to Your for example default Theme folder and given diferent direct link..

for example:

******************************************/
 
  //Configure below to change URL path to the snow image
  var snowsrc="http://www.jr62.com/tp/Themes/default/anotherxxx_snow.gif"


And buttle juice! hehe


Okay..
I give for All my priv little colletion of snowflake small pictures.., (on the Attach), & please welcom!


:knuppel2:
I have idee, maby self little Art-improvision with The Photoshop?

http://www.adobetutorialz.com/articles/2533/1/Christmas-Tree

http://www.photoshoptrail.com/articleview-aid-45-tit-Cool-Latest-free-photo-shop-cs2-tutorial-how-to-make-octagon-snowflake-design-or-banner-image.htm

http://www.pyropixel.com/tut007.php

http://www.myjanee.com/tuts/snow/snow.htm

hehe its easy.. or?  (https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fricoroco.com%2Fforum%2FSmileys%2Fclassic%2FSkull.gif&hash=e5a6508dba6ff3645d8a6e80a612bb4c1564e451)

See ya (https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fricoroco.com%2Fforum%2FSmileys%2Fclassic%2Fsunny.gif&hash=852601aaea482c9eb8eebb1f9a1c2016e276a813)
Title: Re: X-mas Snow Effect
Post by: poisom on December 07, 2007, 02:34:37 AM
its wordefull thnx! check it in my site :-D http://www.designcad.gr !!!
thnx again!!
Title: Re: X-mas Snow Effect
Post by: dreamy_me on December 07, 2007, 09:00:35 PM
Well done poisom,

The site looks great too!

:D
Title: Re: X-mas Snow Effect
Post by: Rus on December 07, 2007, 09:49:53 PM
Thanks for the extra snowflakes too.
Title: Re: X-mas Snow Effect
Post by: fauzimz on December 18, 2007, 01:55:04 PM
see sample snow here http://www.caldinaclub.com/index.php
Title: Re: X-mas Snow Effect
Post by: jdvarner on December 19, 2007, 02:04:26 AM
just curious if others having complaints from members regards using this cool snow flake item and running on forum with arcade? my users claim arcade unaccessible or slow when this applied... but admin sees no issues. runs fine.
Title: Re: X-mas Snow Effect
Post by: lurkalot on December 19, 2007, 09:15:32 AM
Quote from: jdvarner on December 19, 2007, 02:04:26 AM
just curious if others having complaints from members regards using this cool snow flake item and running on forum with arcade? my users claim arcade unaccessible or slow when this applied... but admin sees no issues. runs fine.

Was going to ask the same thing.    I have tried this script myself, and although it works fine, I cant get it to show on my home page, but it does show in the forums, and the arcade and that does slow things up a bit, not to mention its very distracting while playing games.

Is there a way of making this show on the front page only?   I'm using it in a center block.   

PS:  What is a front page block? as this doesn't appear to do anything. :(
Title: Re: X-mas Snow Effect
Post by: IchBin on December 19, 2007, 03:25:02 PM
frontpage block is exactly what it says. A front page block. Its not a center block, as it only appears on the frontpage.

You can only show it to membergroups by adding some php code around it.

if (in_array(5, $user_info['groups']))
echo 'your code here';


The number 5 would indicate the group ID number.
Title: Re: X-mas Snow Effect
Post by: Teal on December 23, 2007, 12:48:10 AM
I have been working on my own version of this effect and seem to have it working well with little or no performance loss. I do however notice one thing and that is when viewing with Internet Explorer (6), I have to "refresh" the page in order for the snow to fall (every time). When viewing with FireFox, this does not happen.

Does anyone have any idea of why this might be?

Thanks

The effect can be viewed here: http://www.hellzhawtdogz.com/oscar/index.php?action=forum
Title: Re: X-mas Snow Effect
Post by: jdvarner on December 23, 2007, 01:17:53 AM
works fine in ie7, runs fast though. the flakes that is. i'd slow it down a bit.
Title: Re: X-mas Snow Effect
Post by: Teal on December 23, 2007, 04:00:07 AM
Thanks for the reply! If you follow the link and then hit the "forum" tab (top left), you will probably see the issue as I describe. You will then also an see an  "error on the page" as shown on the bottom left of the browser window.
Title: Re: X-mas Snow Effect
Post by: lurkalot on December 23, 2007, 10:04:22 AM
Teal, works fine for me in IE7, can't see an error at bottom either. ;)
Title: Re: X-mas Snow Effect
Post by: contra on December 17, 2008, 02:31:38 PM
awesome...

here is my site with the snow

www.offroadjunkies.net
Title: Re: X-mas Snow Effect
Post by: halfpint1 on November 26, 2009, 08:04:50 PM
hi i have tried putting the code in a center block for my front page but get nothing can someone tell me what i am doing wrong. i used the code at the beginning of the thread. help please!!
Title: Re: X-mas Snow Effect
Post by: Lesmond on November 26, 2009, 09:51:46 PM
What sort of block did you use halfpint1?
Title: Re: X-mas Snow Effect
Post by: halfpint1 on November 27, 2009, 07:06:59 AM
i used a center block (scriptbox) cheers.
Title: Re: X-mas Snow Effect
Post by: lurkalot on November 27, 2009, 09:57:00 AM
Quote from: halfpint1 on November 26, 2009, 08:04:50 PM
hi i have tried putting the code in a center block for my front page but get nothing can someone tell me what i am doing wrong. i used the code at the beginning of the thread. help please!!

Probably a silly question, but did you unzip the seasons folder, and upload it to your forum folder.  At bottom of first post.  ;)
Title: Re: X-mas Snow Effect
Post by: halfpint1 on November 27, 2009, 11:42:17 AM
i will have to check with my mod to see if that is what he did. will get back to u asap. cheers.
Title: Re: X-mas Snow Effect
Post by: halfpint1 on November 27, 2009, 05:56:41 PM
he copy and pasted the code at the beginning of this thread. it was't in a zip file.
Title: Re: X-mas Snow Effect
Post by: lurkalot on November 27, 2009, 06:14:32 PM
Quote from: halfpint1 on November 27, 2009, 05:56:41 PM
he copy and pasted the code at the beginning of this thread. it was't in a zip file.

At the bottom of that first post there's also a zip to download.  This contains all the snowflake images, and all the other necessary bits to make the block work.  You need to download this zip unzip it, and then upload folder to your forum root. ;)
Title: Re: X-mas Snow Effect
Post by: halfpint1 on November 27, 2009, 07:09:07 PM
cheers will let you know if i get it to work ur a star thanx.
Title: Re: X-mas Snow Effect
Post by: halfpint1 on November 27, 2009, 08:11:33 PM
it saying not a valid pkg and become corrupted. uploaded to forum root but won't work at all any suggestions pretty please
Title: Re: X-mas Snow Effect
Post by: JPDeni on November 27, 2009, 08:31:59 PM
This is not an SMF mod. Just unzip the file and put the files in your forum root directory. Put the javascript into a javascript block. That's it.
Title: Re: X-mas Snow Effect
Post by: halfpint1 on November 27, 2009, 08:39:26 PM
i dont have a javascript block on my site. i have tiny portal block manager on the site. we have put the files in the root directory but it no worky. so we have given up trying to get it to open the file.

thanks for your help though i appreciate it.
Title: Re: X-mas Snow Effect
Post by: Lesmond on November 27, 2009, 09:12:43 PM
halfpint1

you should have this in tp (https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fi49.tinypic.com%2Frw46bm.gif&hash=adf977f9f59d6b227d890818fd65976d4865f8e1)
Title: Re: X-mas Snow Effect
Post by: halfpint1 on November 27, 2009, 09:30:06 PM
mine says html + BBC

i have these that i can apply to a block. (center, front page, left side and right side blocks)

userbox
newsbox
statsbox
searchbox
html + BBC
onlinebox
themebox
shoutbox
menubox
phpbox
scriptbox
recent topics
SSI function
TP module
RSS feed
sitemap
admin tools
one article
article category
Title: Re: X-mas Snow Effect
Post by: Lesmond on November 27, 2009, 09:37:09 PM
then use the "scriptbox"
Title: Re: X-mas Snow Effect
Post by: lurkalot on November 28, 2009, 07:45:35 AM
Quote from: halfpint1 on November 27, 2009, 09:30:06 PM
mine says html + BBC

i have these that i can apply to a block. (center, front page, left side and right side blocks)

scriptbox


You are so close to getting it working.  ;)

Unzip the seasons folder and FTP (upload) the unzipped seasons folder to your forum directory.

Add the block code supplied from the first post to a center block / scriptbox.

Save then activate.

Remember.  Put it in a Center / scriptbox if you want it to display in your forums.  You can also single out a particular board in which you want to display it.   

Or put it in a Front / scriptbox if you want it to display on your home page.
Title: Re: X-mas Snow Effect
Post by: othg_weasel on December 11, 2009, 03:18:52 AM
I am interested in this snow effect. I have unziped the seasons file and uploaded the folder to the root folder of my forum. when I try to paste the code into my  front page block I see the code after I paste it then I hit save and most of the code vanishes. I have even tryed it in normal article block and to code does the same thing.

any incite?
Title: Re: X-mas Snow Effect
Post by: IchBin on December 11, 2009, 03:47:24 AM
What version of TP are you using? Are you putting the code in the editor in the code mode by pressing the <> button?
Title: Re: X-mas Snow Effect
Post by: othg_weasel on December 11, 2009, 04:11:07 AM
sorry I add my info to my sig.

Yes I use the <> button to add the code the when I hit hide html the code is gone. I have even tried to hit save while the code is still visible. But no luck.

I believe I am doing everything right because the what it does leave is this.

<table 0?="" bgcolor="#ffffff" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td align="middle"><img src="http://thecabinscrew.com/tp2/seasons/merry_christmas.jpg"> </td></tr></tbody></table><br>



I'm able to see Santa in so i know the folder is in the correct place...

Ideas?
Title: Re: X-mas Snow Effect
Post by: IchBin on December 11, 2009, 04:59:03 AM
Try changing it to a PHP block type. Then save the code in that block. Then change it back to a html/javascript block. See if that helps. Looks like something in the code doesn't agree with the editor I guess.
Title: Re: X-mas Snow Effect
Post by: othg_weasel on December 11, 2009, 12:37:59 PM
LOL ya that worked. Changed it to a BBC code saved it then changed it back and it worked.

Thank you sir.  :coolsmiley: