cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

Quick-add: + add another resource

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              <head>
          
    </header>

 
<header><center>
        <div class="text-vcenter"><h1>Glaser's Images, Eggs and Intrigues</div>
    </header>
<p><h1>
  
  <center><em>Glaser Electronic Portfolio <head><br><A name ="Part1: Original Image"></a><br> 
    <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/496283/myImage(1).png" width ="20%"/><br><br> <h3> CODE: </center><H4><CENTER> 
   var image = new SimpleImage(256,256);<BR>
 for(var pixel of image.values()){<BR>
     if(pixel.getY()>2*image.getHeight()/9 +45*Math.sin(pixel.getX()/20))<BR>
     var x = (pixel.getX()/128.0) - 1;<BR>
     var y = (pixel.getY()/128.0) - 1;<BR>
     var value = (x/y +1)*128;<BR>
     pixel.setRed(10);<BR>
     pixel.setGreen(value);<BR>
     pixel.setBlue(100);<BR>    
 }
 print(image);<BR>
    
    <Center><h2>EXPLANATION </center>
The desired colors for this was green and purple.<br> Therefore, the RGB values were set topixel.setRed(150);<br>     pixel.setGreen(value);     pixel.setBlue(150);
I wanted a wavy effect so tried incorporating the sin wave algo.<br> (At some point, I want to use a dragonfly logo and I think working with this sin function could be useful.) <br> The if statement in the first line of the for loop is computing a sin wave based on the x value. It checks if the y-value is above a certain value or below a certain value. <br> The 2 is the only difference between comparison of the pixel.getY() less than an and the pixel.getY()greater than. <br> The two lines within the loop transform the original (x,y) values from their range of 0…255 to -1..1 as stored in the local variables x and y. <br>  
for(var pixel of image.values()){
     if(pixel.getY()>2*image.getHeight()/9 +45*Math.sin(pixel.getX()/20))
Then, the third line divides x by y which produces interesting results because it “reverses the sign” putting high values (bright) ext to low values (dark) because -1/-1 is a positive value and -1/1 is a negative value.  
     var value = (x/y +1)*128;<br>
The end expression changes the resulting division back from the range -1…1 to Java’s color range of 0…255.<br>
      var value = (x/y +1)*128;<br><br><br>
      
      
            
          
!
            
              @import url(https://fonts.googleapis.com/css?family=Righteous|Roboto);
h1 {text-align: center; background-color: #cc99ff;}
table border {background-color: black;}
ul {list-style-type:none;}
p {
    background-color: #ff6600;
}
tr {
    background: #99ff99;
}  
h6 {background-color: lightyellow;}
ul{background-color: lightyellow;}

div {
    width: 500px;
    height: 100px;
    border: 3px solid #73AD21;
}
div {
    width: 500px;
    height: 50px;
    border: 3px solid #73AD21;
}



            
          
!
999px
Loading ..................

Console