css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

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.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.


        <div class="text-vcenter"><h1>Glaser's Images, Eggs and Intrigues</div>
  <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>
    <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;

🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................