Avatar billede montago Praktikant
28. december 2003 - 14:49 Der er 1 kommentar og
1 løsning

Palette i ASP vha Tables

Jeg har problemmer at få højresiden til at fade rigtig mod Hvid... se efter 'hjælp med denne ligning

<%
    Dim Coolness, Tal
    Tal = 150
    FOR Coolness = 0 to Tal step 1
%>
<% 
    Dim intRed, intGreen, intBlue, strColor

    if (coolness <= int(Tal/6)) then 'TAL<50
        intRed         = int((coolness / int(Tal/6)) * 255)
        intGreen     = 255
        intBlue     = 0
    elseif (coolness > int(Tal/6)) and (coolness <= int(Tal/3)) then '50<Tal<100
        intRed         = 255
        intGreen     = int(((int(Tal/3) - coolness) / int(Tal/6)) * 255)
        intBlue     = 0
    elseif (coolness > int(Tal/3)) and (coolness <= int(Tal/2)) then '100<Tal<150
        intRed         = 255
        intGreen     = 0
        intBlue     = int(255*((coolness - int(Tal/3))/(int(Tal/2)-int(Tal/3))))
    elseif (coolness > int(Tal/2)) and (coolness <= int(Tal/1.5)) then '150<Tal<200
        intRed         = 255 - int(255*((coolness - int(Tal/2))/(int(Tal/1.5)-int(Tal/2))))
        intGreen     = 0
        intBlue     = 255
    elseif (coolness > int(Tal/1.5)) and (coolness <= int(Tal/1.2)) then '200<Tal<250
        intRed         = 0
        intGreen     = int(255*((coolness - int(Tal/1.5))/(int(Tal/1.2)-int(Tal/1.5))))
        intBlue     = 255
    else '250<Tal<300
        intRed         = 0
        intGreen     = 255
        intBlue     = 255 - int(255*((coolness - int(Tal/1.2))/(int(Tal)-int(Tal/1.2))))
    end if
   
   
   
%>
    <table border="0" cellspacing="0" cellpadding="0">
      <tr>
<%
    Dim Nuance, Tal2, Tal3, Gubbi
    Tal2 = 150
    For Nuance = 0 to Tal2 step 1
    Tal3 = int(Tal2 / 2)
    Gubbi = Nuance - (Tal2/2)
   
        if (Nuance < Tal2/2) then
            intRedNuance     = int(Nuance/Tal2 * intRed *2)
            intGreenNuance    = int(Nuance/Tal2 * intGreen *2)
            intBlueNuance    = int(Nuance/Tal2 * intBlue *2)
        elseif (Nuance > Tal2/2) then
            intRedNuance     = int((Nuance - Tal3)/Tal2 * (intRed)) 'Hjælp med denne ligning
            intGreenNuance    = int((Nuance - Tal3)/Tal2 * (intGreen)) 'hjælp med denne ligning
            intBlueNuance    = int((Nuance - Tal3)/Tal2 * (intBlue)) 'hjælp med denn ligning
        end if
   
        strColor = "rgb(" & intRedNuance & "," & intGreenNuance & "," & intBlueNuance & ")"
        Response.Write("<td><table style='background-color:" & strColor & "' border=""0"" cellpadding=""0"" cellspacing=""0"" width=""2"" height=""2""><tr><td align=""center""></td></tr></table></td>")
   
    Next
%>
      </tr>
    </table>
<%
    Next
%>
Avatar billede montago Praktikant
29. december 2003 - 16:19 #1
har efter 20 timer selv fundet ud af det !


<%
    Response.Buffer = True
    Dim Coolness, Tal
    Tal = 200
    FOR Coolness = 0 to Tal step 1
%>
<% 
    Dim intRed, intGreen, intBlue, strColor

    if (coolness <= int(Tal/6)) then 'TAL<50
        intRed         = int((coolness / int(Tal/6)) * 255)
        intGreen     = 255
        intBlue     = 0
    elseif (coolness > int(Tal/6)) and (coolness <= int(Tal/3)) then '50<Tal<100
        intRed         = 255
        intGreen     = int(((int(Tal/3) - coolness) / int(Tal/6)) * 255)
        intBlue     = 0
    elseif (coolness > int(Tal/3)) and (coolness <= int(Tal/2)) then '100<Tal<150
        intRed         = 255
        intGreen     = 0
        intBlue     = int(255*((coolness - int(Tal/3))/(int(Tal/2)-int(Tal/3))))
    elseif (coolness > int(Tal/2)) and (coolness <= int(Tal/1.5)) then '150<Tal<200
        intRed         = 255 - int(255*((coolness - int(Tal/2))/(int(Tal/1.5)-int(Tal/2))))
        intGreen     = 0
        intBlue     = 255
    elseif (coolness > int(Tal/1.5)) and (coolness <= int(Tal/1.2)) then '200<Tal<250
        intRed         = 0
        intGreen     = int(255*((coolness - int(Tal/1.5))/(int(Tal/1.2)-int(Tal/1.5))))
        intBlue     = 255
    else '250<Tal<300
        intRed         = 0
        intGreen     = 255
        intBlue     = 255 - int(255*((coolness - int(Tal/1.2))/(int(Tal)-int(Tal/1.2))))
    end if
%>
    <table border="0" cellspacing="0" cellpadding="0">
      <tr>
<%
    Dim Nuance, Tal2
    Dim ROZ, GOZ, BOZ
        Tal2 = 150
    For Nuance = 0 to Tal2 step 1
       
        if (intRed > 127) then
            ROZ = int(255 - intRed     / 2 / 127 * 255)
        elseif (intRed < 127) then
            ROZ = int(255 - intRed     / 2 / 127 * 255) * -1
        end if
        if (intGreen > 127) then
            GOZ = int(255 - intGreen / 2 / 127 * 255)
        elseif (intGreen < 127) then
            GOZ = int(255 - intGreen / 2 / 127 * 255) * -1
        end if
        if (intBlue > 127) then
            BOZ = int(255 - intBlue  / 2 / 127 * 255)
        elseif (intBlue < 127) then
            BOZ = int(255 - intBlue  / 2 / 127 * 255) * -1
        end if
           
        if (Nuance < tal2/2) then
            intRedNuance     = int(Nuance/Tal2 * intRed *2)
            intGreenNuance    = int(Nuance/Tal2 * intGreen *2)
            intBlueNuance    = int(Nuance/Tal2 * intBlue *2)
        elseif (Nuance > tal2/2) then '(255-Farve)/100 X + Farve
            intRedNuance     = int((510-(2*intRed))/Tal2     * Nuance)     + (255-(510-(2*intRed)))
            intGreenNuance    = int((510-(2*intGreen))/Tal2     * Nuance)     + (255-(510-(2*intGreen)))
            intBlueNuance    = int((510-(2*intBlue))/Tal2     * Nuance)     + (255-(510-(2*intBlue)))
        end if
   
        strColor = "rgb(" & intRedNuance & "," & intGreenNuance & "," & intBlueNuance & ")"
        Response.Write("<td><table style='background-color:" & strColor & "' border=""0"" cellspacing=""0"" width=""1"" height=""1""><tr><td></td></tr></table></td>")
   
    Next
%>
      </tr>
    </table>
<%
    Next
%>
Avatar billede montago Praktikant
29. december 2003 - 16:19 #2
asd
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester