Glittering stars background

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Miha Kovac

    #1

    Glittering stars background

    Hi,

    can anybody help me with this one please.

    How can I make a glittering stars effect for my background?

    Please help, TIA

    M


  • JimMenees

    #2
    Re: Glittering stars background

    Hi,
    You might be looking for this java applet:



    or


    Comment

    • Markus Ernst

      #3
      Re: Glittering stars background

      "Miha Kovac" <mihakovac@yaho o.com> schrieb im Newsbeitrag
      news:WY4qb.5197 $2B6.1007605@ne ws.siol.net...[color=blue]
      > Hi,
      >
      > can anybody help me with this one please.
      >
      > How can I make a glittering stars effect for my background?
      >
      > Please help, TIA
      >
      > M
      >
      >[/color]

      Make an animated background gif.

      --
      Markus


      Comment

      • Lee

        #4
        Re: Glittering stars background

        Miha Kovac said:[color=blue]
        >
        >Hi,
        >
        >can anybody help me with this one please.
        >
        >How can I make a glittering stars effect for my background?[/color]

        Here's a fairly simple-minded Javascript implementation.
        In practice, I would probably want to modify the script to
        automatically place a specified (or random) number of stars,
        would tweak the timing, and, of course, would use better
        graphics:

        <html>
        <head>
        <script type="text/javascript">
        var starList=new Array();
        var starState=new Array(3);
        for(var i=0;i<starState .length;i++){
        starState[i]=new Image(20,20);
        starState[i].src="http://www.azphx.com/tmp/star"+i+".gif";
        }
        function twinkle(n){
        starList[n].src=starState[Math.floor(Math .random()*3)].src;
        setTimeout("twi nkle("+n+")",Ma th.floor(Math.r andom()*1000+50 0));
        }
        function init(){
        var i=0;
        var star;
        var id="star"+((i<1 0)?"0":"")+i;
        while(star=docu ment.getElement ById(id)){
        starList[i]=star;
        setTimeout("twi nkle("+i+")",Ma th.floor(Math.r andom()*1000+50 0));
        i++;
        id="star"+((i<1 0)?"0":"")+i;
        }
        }
        </script>
        </head>
        <body onload="init()" >
        <div style="position :absolute;top:1 0px;left:10px"[color=blue]
        ><img id="star00" src="star0.gif" ></div>[/color]
        <div style="position :absolute;top:1 0px;left:100px"[color=blue]
        ><img id="star01" src="star0.gif" ></div>[/color]
        <div style="position :absolute;top:1 00px;left:100px "[color=blue]
        ><img id="star02" src="star0.gif" ></div>[/color]
        <div style="position :absolute;top:3 0px;left:50px"[color=blue]
        ><img id="star03" src="star0.gif" ></div>[/color]
        <div style="position :absolute;top:6 0px;left:40px"[color=blue]
        ><img id="star04" src="star0.gif" ></div>[/color]
        </body>
        </html>

        Comment

        • cwdjr

          #5
          Re: Glittering stars background

          I made a dhtml twinkle effect generator for some children several
          months ago. You can use stars, text, or even flying pigs. The script
          generated had to be kept simple and had to include document.all since
          some had MSNTV that will not support getElementById. The scripts
          generated thus work on IE and relatives as well as Opera, but not
          Mozilla and Netscape. It would not be much trouble to extend the code
          to include getElementById once you have generated a script you like.
          See http://www.wtv-zone.com/cwdjrsxyz/to...generator.html .

          Comment

          • Remie en Roosje

            #6
            Re: Glittering stars background


            "Miha Kovac" <mihakovac@yaho o.com> schreef in bericht
            news:WY4qb.5197 $2B6.1007605@ne ws.siol.net...[color=blue]
            > Hi,
            >
            > can anybody help me with this one please.
            >
            > How can I make a glittering stars effect for my background?
            >
            > Please help, TIA
            >
            > M
            >
            > By using this javascript you cam move your background. So make a glitter[/color]
            jpg (or other) and put de script in your body.

            <script language="JavaS cript">
            <!-- Begin
            var backgroundOffse t = 0;
            var bgObject = eval('document. body');
            function scrollBG(maxSiz e) {
            backgroundOffse t = backgroundOffse t + 1;
            if (backgroundOffs et > maxSize) backgroundOffse t = 0;
            bgObject.style. backgroundPosit ion = "0 " + backgroundOffse t;
            }
            var ScrollTimer = window.setInter val("scrollBG(3 07)", 64);
            // End -->
            </script>

            Grtz, Remie


            Comment

            • HikksNotAtHome

              #7
              Re: Glittering stars background

              In article <bol1vc$6pr$1@n ews.hccnet.nl>, "Remie en Roosje"
              <remieftp@hotma il.com> writes:
              [color=blue]
              ><script language="JavaS cript">[/color]

              language attribute is deprecated, use type="text/javascript" instead
              [color=blue]
              ><!-- Begin[/color]

              Hiding scripts from the browser is no longer required, drop it. If you want to
              comment the beginning, use a js comment instead.
              [color=blue]
              >var backgroundOffse t = 0;
              >var bgObject = eval('document. body');[/color]

              Why the unneeded use of eval to get a reference to the body?
              Since you only call bgObject in one place, simply skip it and use the direct
              reference there.
              [color=blue]
              >function scrollBG(maxSiz e) {
              >backgroundOffs et = backgroundOffse t + 1;
              >if (backgroundOffs et > maxSize) backgroundOffse t = 0;
              >bgObject.style .backgroundPosi tion = "0 " + backgroundOffse t;[/color]

              drop the above eval, and replace the above line with:

              document.body.s tyle.background Position = "0 " + backgroundOffse t;
              [color=blue]
              >}
              >var ScrollTimer = window.setInter val("scrollBG(3 07)", 64);[/color]

              [color=blue]
              >// End -->[/color]

              The closing HTML comment is unneeded.
              [color=blue]
              ></script>[/color]


              --
              Randy

              Comment

              • Lasse Reichstein Nielsen

                #8
                Re: Glittering stars background

                "Remie en Roosje" <remieftp@hotma il.com> writes:
                [color=blue]
                > By using this javascript you cam move your background. So make a glitter
                > jpg (or other) and put de script in your body.[/color]

                Just because I can't let an "eval" go by uncommented ...
                [color=blue]
                > <script language="JavaS cript">[/color]

                In HTML 4 and forward, the type attribute is required (and the
                language attribute is deprecated). The type attribute is also
                backwards compatible, so there is no reason for not using
                <script type="text/javascript">
                [color=blue]
                > <!-- Begin[/color]

                HTML comments are not necessary in Javascript.
                [color=blue]
                > var backgroundOffse t = 0;
                > var bgObject = eval('document. body');[/color]

                This call to "eval" is completely spurious. Simply
                var bgObject = document.body;
                would be equivalent.
                I have had problems with putting this code in the head element,
                because the document.body doesn't exist yet at that point.
                Since bgObject is only used once in the code, simply writing
                document.body directly there would solve that problem.
                [color=blue]
                > function scrollBG(maxSiz e) {[/color]
                [color=blue]
                > backgroundOffse t = backgroundOffse t + 1;
                > if (backgroundOffs et > maxSize) backgroundOffse t = 0;[/color]

                For purely esthetic reasons, I prefer the shorter lines
                backgroundOffse t++;
                backgroundOffse t %= maxSize;
                I know that others want the more describing if statement,
                so that's just a matter of style.
                [color=blue]
                > bgObject.style. backgroundPosit ion = "0 " + backgroundOffse t;[/color]

                To be correct CSS, the backgroundOffse t should have a unit, most likely
                pixels. I.e.,

                bgObject.style. backgroundPosit ion = "0 " + backgroundOffse t + "px";

                The lacking "px" will make this code fail on some browsers in standards
                compliant mode. Opera 7 seems to think that no unit means "em", giving
                a much faster scroll than you want.

                (The value "0" doesn't need a unit. However, I recommend giving it one
                anyway, for consistency).

                /L
                --
                Lasse Reichstein Nielsen - lrn@hotpop.com
                DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
                'Faith without judgement merely degrades the spirit divine.'

                Comment

                • Jim Ley

                  #9
                  Re: Glittering stars background

                  On 09 Nov 2003 12:39:51 +0100, Lasse Reichstein Nielsen
                  <lrn@hotpop.com > wrote:
                  [color=blue]
                  >In HTML 4 and forward, the type attribute is required (and the
                  >language attribute is deprecated).[/color]

                  There will be no more versions of HTML so deprecated has no meaning,
                  it has equivalent status as the type attribute...
                  [color=blue]
                  > The type attribute is also
                  >backwards compatible, so there is no reason for not using
                  > <script type="text/javascript">[/color]

                  Sure, this is to be prefered.
                  [color=blue][color=green]
                  >> <!-- Begin[/color]
                  >
                  >HTML comments are not necessary in Javascript.[/color]

                  That's a javascript comment, not an HTML one, and it can cause no harm
                  (in XHTML things are different of course)

                  Jim.
                  --
                  comp.lang.javas cript FAQ - http://jibbering.com/faq/

                  Comment

                  • Lasse Reichstein Nielsen

                    #10
                    Re: Glittering stars background

                    jim@jibbering.c om (Jim Ley) writes:
                    [color=blue]
                    > On 09 Nov 2003 12:39:51 +0100, Lasse Reichstein Nielsen
                    > <lrn@hotpop.com > wrote:
                    >[color=green]
                    > >In HTML 4 and forward, the type attribute is required (and the
                    > >language attribute is deprecated).[/color]
                    >
                    > There will be no more versions of HTML so deprecated has no meaning,
                    > it has equivalent status as the type attribute...[/color]

                    Deprecated also means that it is absent in HTML 4 Strict. That is a
                    difference in status (maybe more to me than in general, since I always
                    (try to) write strict HTML)

                    I must admit that by "and forward", I was thinking of XHTML, which is
                    the logical sucessor to HTML. If you have a better way of saying the
                    same, I would be happy to use it :)

                    [color=blue][color=green][color=darkred]
                    > >> <!-- Begin[/color]
                    > >
                    > >HTML comments are not necessary in Javascript.[/color]
                    >
                    > That's a javascript comment, not an HTML one, and it can cause no harm
                    > (in XHTML things are different of course)[/color]

                    The string "<!--" begins an HTML comment. It is not part of ECMAScript
                    at all, and is not mentioned in the comments section of Netscape's
                    Javascript 1.5 reference (or 1.3 or 1.4, which have almost identical
                    wordings) .
                    <URL:http://devedge.netscap e.com/library/manuals/2000/javascript/1.5/reference/comment.html#10 66582>
                    To me, that means that it is not a Javascript comment. It is an HTML
                    comment that is accepted by the Javascript interpreters in browsers.

                    /L
                    --
                    Lasse Reichstein Nielsen - lrn@hotpop.com
                    DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
                    'Faith without judgement merely degrades the spirit divine.'

                    Comment

                    • Jim Ley

                      #11
                      Re: Glittering stars background

                      On 09 Nov 2003 13:07:56 +0100, Lasse Reichstein Nielsen
                      <lrn@hotpop.com > wrote:
                      [color=blue]
                      >jim@jibbering. com (Jim Ley) writes:
                      >[color=green]
                      >> On 09 Nov 2003 12:39:51 +0100, Lasse Reichstein Nielsen
                      >> <lrn@hotpop.com > wrote:
                      >>[color=darkred]
                      >> >In HTML 4 and forward, the type attribute is required (and the
                      >> >language attribute is deprecated).[/color]
                      >>
                      >> There will be no more versions of HTML so deprecated has no meaning,
                      >> it has equivalent status as the type attribute...[/color]
                      >
                      >Deprecated also means that it is absent in HTML 4 Strict. That is a
                      >difference in status (maybe more to me than in general, since I always
                      >(try to) write strict HTML)[/color]

                      Sure, not in strict is good, but deprecated is IMO irrelevant when
                      talking about HTML, there being no future HTML's...
                      [color=blue]
                      >I must admit that by "and forward", I was thinking of XHTML, which is
                      >the logical sucessor to HTML.[/color]

                      Well, given that it has a different mime-type, I don't buy that, it's
                      a different beast (certainly in the same problem space, but it's not
                      the same thing.)
                      [color=blue][color=green]
                      >> That's a javascript comment, not an HTML one, and it can cause no harm
                      >> (in XHTML things are different of course)[/color]
                      >
                      >The string "<!--" begins an HTML comment.[/color]

                      The content model of SCRIPT is CDATA - you're not allowed comments
                      inside it, therefore that must be part of the script, and passed to
                      the script engine. Certainly it's not part of ECMAScript, but that is
                      not an HTML comment - they're not legal inside SCRIPT blocks (this is
                      the change with XHTML of course where the content model of script
                      changed to PCDATA which allows comments.)

                      It's either a javascript comment, or something that the javascript
                      engine accepts as if it was a comment - it's passed as is via the HTML
                      parser.

                      Jim.
                      --
                      comp.lang.javas cript FAQ - http://jibbering.com/faq/

                      Comment

                      • Lasse Reichstein Nielsen

                        #12
                        Re: Glittering stars background

                        jim@jibbering.c om (Jim Ley) writes:
                        [color=blue]
                        > Well, given that it has a different mime-type, I don't buy that, it's
                        > a different beast (certainly in the same problem space, but it's not
                        > the same thing.)[/color]

                        It might have a different content type, but comparing HTML 4.01 and
                        XHTML 1.0, they have the same:
                        - tag names
                        - attribute names
                        - attribute values (except that they cannot be omitted)
                        - deprecated tags
                        - deprecated attributes

                        I would say that it is very much the same *thing*, just with a
                        slightly different *syntax*. I don't see HTML as only the syntax, but
                        also as the semantic content associated to each element type. The
                        content type only tells us the syntax.

                        If going from HTML 3 to HTML 4 was a step forward, then going from
                        HTML 4 to XHTML 1.0 is just a step to the left, but still on the same
                        path.
                        [color=blue]
                        > The content model of SCRIPT is CDATA - you're not allowed comments
                        > inside it, therefore that must be part of the script, and passed to
                        > the script engine.[/color]

                        Yes, it is not treated as an HTML comment starter. I will bet that the
                        author *intended* it as an HTML comment starter, though (as it would
                        have been in HTML 2, before the script tag was introduced). He wrote
                        an HTML comment, but did it in a place where it is not interpreted
                        as one.

                        (browsers actually break thier ECMAScript support by using <!-- as
                        an comment-to-end-of-line. Compare these two scripts:
                        ---
                        var x = 1;
                        var y = false <! -- x;
                        alert(y)
                        ---
                        and
                        ---
                        var x = 1;
                        var y = false <!-- x;
                        alert(y)
                        ---
                        The first gives true, the second false, even though whitespace
                        should be irrelevant between operators.)
                        [color=blue]
                        > Certainly it's not part of ECMAScript, but that is not an HTML
                        > comment - they're not legal inside SCRIPT blocks (this is the change
                        > with XHTML of course where the content model of script changed to
                        > PCDATA which allows comments.)[/color]

                        I say that it is an HTML comment, but that it is incorrectly placed.
                        That might, technically, make it not an HTML comment, but then, just
                        as technically, the content of the script tag isn't ECMAScript/
                        Javascript either.
                        [color=blue]
                        > It's either a javascript comment, or something that the javascript
                        > engine accepts as if it was a comment - it's passed as is via the HTML
                        > parser.[/color]

                        That I can agree with that, and votes on the second option of the
                        "or".

                        So, a more correct complain would have been:
                        "You don't need the-token-normally-used-for-starting-HTML-comments in
                        Javscript"
                        If you have a shorter version that says the same, it would be great :)

                        /L
                        --
                        Lasse Reichstein Nielsen - lrn@hotpop.com
                        DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
                        'Faith without judgement merely degrades the spirit divine.'

                        Comment

                        • Jim Ley

                          #13
                          Re: Glittering stars background

                          On 09 Nov 2003 14:02:27 +0100, Lasse Reichstein Nielsen
                          <lrn@hotpop.com > wrote:
                          [color=blue]
                          >jim@jibbering. com (Jim Ley) writes:
                          >[color=green]
                          >> Well, given that it has a different mime-type, I don't buy that, it's
                          >> a different beast (certainly in the same problem space, but it's not
                          >> the same thing.)[/color]
                          >
                          >It might have a different content type,[/color]
                          [color=blue]
                          >I would say that it is very much the same *thing*, just with a
                          >slightly different *syntax*.[/color]

                          No, forget the myth about XHTML 1.0

                          <script type="applicati on/x-jim-script">
                          <!-- Jim --></script>

                          Means diferent things in HTML 4.01 and XHTML 1.0 - they are not the
                          same. (x-jim-script uses <!-- str --> the same as JS uses
                          document.write( "str") - in HTML 4.01, it would write something, in
                          XHTML 1.0 it would not.)
                          [color=blue]
                          > I don't see HTML as only the syntax, but
                          >also as the semantic content associated to each element type. The
                          >content type only tells us the syntax.[/color]

                          It doesn't even tell us that, text/html - is tag soup parse it
                          however, in fact it's more the semantics of the element than the
                          syntax, seen as the incompatible HTML and XHTML syntaxes are both
                          labelled with the same type.
                          [color=blue]
                          >If going from HTML 3 to HTML 4 was a step forward, then going from
                          >HTML 4 to XHTML 1.0 is just a step to the left, but still on the same
                          >path.[/color]

                          I can't agree with this, they are syntactically and even in some cases
                          semantically different, the only thing they have in common is that
                          they both can be rendered by tag-soup slurpers.
                          [color=blue]
                          >Yes, it is not treated as an HTML comment starter. I will bet that the
                          >author *intended* it as an HTML comment starter,[/color]

                          We can only assume that the author intended it to meet the document
                          they described it as, we can't assume the author is an idiot.
                          [color=blue]
                          >I say that it is an HTML comment, but that it is incorrectly placed.[/color]

                          If it was XHTML 1.0 as application/xhtml+xml it would be (and the
                          script MUST not be executed), if it's text/html it is not a comment,
                          it's part of the script - We either follow the standard, or we ignore
                          it...
                          [color=blue]
                          >That might, technically, make it not an HTML comment, but then, just
                          >as technically, the content of the script tag isn't ECMAScript/
                          >Javascript either.[/color]

                          Sure it is - as you noted javascript implementations consider <!-- to
                          be a single line comment, it's not core ecmascript, but you're free to
                          extend ecmascript however you want.
                          [color=blue]
                          >So, a more correct complain would have been:
                          >"You don't need the-token-normally-used-for-starting-HTML-comments in
                          >Javscript"
                          >If you have a shorter version that says the same, it would be great :)[/color]

                          I'd not complain about it, it's perfectly safe, it's only a problem if
                          you choose to author XHTML 1.0, seen as that's such a difficult thing
                          to do, I'd stick with HTML 4.01, and leave it in (although in my
                          personal authoring I don't bother, but then other people include other
                          comments which I wouldn't bother about.

                          Jim.
                          --
                          comp.lang.javas cript FAQ - http://jibbering.com/faq/

                          Comment

                          Working...