Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7

Thread: Image Trouble

  1. #1
    New to the CF scene
    Join Date
    Jul 2003
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Image Trouble

    I am trying to create a script that will rotate an image around a central logo. This is what I have...

    <!doctype HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
    <head>
    <script>
    function SpinImage(ImageID, InitAng)
    {
    xPos = Math.cos(InitAng) * 180;
    xPos = xPos + 385;
    document.getElementById(ImageID).style.pixelLeft = xPos;
    yPos = Math.sin(InitAng) * 180;
    yPos = yPos + 185;
    document.getElementById(ImageID).style.pixelTop = yPos;
    InitAng = InitAng + 0.01;
    SpinTimer=setTimeout("SpinImage()", 90);
    }
    </script>
    <title>
    </title>

    </head>
    <body>
    <img src="untitled.bmp" name="Image1" onLoad="SpinImage("Image1", 1.4273)" style="position:absolute;"></img>

    </body>

    </html>

    Thanks for any help

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    Nashua, NH
    Posts
    1,724
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Vladdy | KL
    "Working web site is not the one that looks the same on common graphical browsers running on desktop computers, but the one that adequately delivers information regardless of device accessing it"

  • #3
    New to the CF scene
    Join Date
    Jul 2003
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    it didn't... i can;t read that well

    and it goes in an ellipse

  • #4
    Senior Coder
    Join Date
    Jun 2002
    Location
    Nashua, NH
    Posts
    1,724
    Thanks
    0
    Thanked 0 Times in 0 Posts
    circle is an ellipse with zero distance beween focal points...
    In my script set radii to the same value and it will move in circle
    Vladdy | KL
    "Working web site is not the one that looks the same on common graphical browsers running on desktop computers, but the one that adequately delivers information regardless of device accessing it"

  • #5
    New to the CF scene
    Join Date
    Jul 2003
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    yes i understand geometry... lol sorry its been a long day

    i wrote this script over a year ago and lost it today, and i'm trying to get it back.

    Now what i had in should work, it is almost exactly what you wrote. I can't read through that well though, I write code more spaced out so I can read it easier...

    the computer has been giving me stupid errors like "out of memory" and things like that when i run the code. right now it wants a ")" where there already is one...

    currently the code is:

    <!doctype HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
    <head>
    <title>
    </title>
    </head>
    <body>
    <div id="image1" style="position:absolute;" onLoad="SpinImage("image1",0)">
    <img src = "image.jpg">
    </div>
    <script>
    var xPos;
    var yPos;

    function SpinImage(ImageID, InitAng)
    {
    xPos = Math.cos(InitAng) * 180;
    xPos = xPos + 385;
    document.getElementById(ImageID).style.pixelLeft = xPos + "px";
    yPos = Math.sin(InitAng) * 180;
    yPos = yPos + 185;
    document.getElementById(ImageID).style.pixelTop = yPos + "px";
    InitAng = InitAng + 0.01;
    SpinTimer=setTimeout("SpinImage("image1", InitAng)", 90);
    }
    </script>


    </body>
    </html>

    It says it is missing a parentheses in the timer line... can you help with that?

  • #6
    Senior Coder
    Join Date
    Jun 2002
    Location
    Nashua, NH
    Posts
    1,724
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Mine are red
    Originally posted by Insanity Inc
    <!doctype HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">All new documents should really be Strict compliant
    <html>
    <head>
    <title>
    </title>
    </head>
    <body>
    <div id="image1" style="position:absolute;" onLoad="SpinImage("image1",0)"> div element does not have onload event, just body (and a few other elements, which are out of scope of this discussion)
    <img src = "image.jpg">
    </div>
    <script>
    var xPos;
    var yPos;

    function SpinImage(ImageID, InitAng)
    {
    xPos = Math.cos(InitAng) * 180;
    xPos = xPos + 385;
    document.getElementById(ImageID).style.pixelLeft = xPos + "px"; pixelLeft is not part of style
    yPos = Math.sin(InitAng) * 180;
    yPos = yPos + 185;
    document.getElementById(ImageID).style.pixelTop = yPos + "px";nor is pixelTop
    InitAng = InitAng + 0.01;
    SpinTimer=setTimeout("SpinImage("image1", InitAng)", 90);Watch for nested qoutes
    }
    </script>


    </body>
    </html>
    Vladdy | KL
    "Working web site is not the one that looks the same on common graphical browsers running on desktop computers, but the one that adequately delivers information regardless of device accessing it"

  • #7
    New to the CF scene
    Join Date
    Jul 2003
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks... so what would I use to load, and how to set the values then, as well as fix the quotes


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •