Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <script type='application/processing' target='processing'>
 float framerate = 24; // our "sketch" will have a framerate of 24 frames per second.
  
 PImage pumpkin;

 int ball_x;           // ball administration: x coordinate
 int ball_y;           // ball administration: y coordinate
 int ball_radius = 300; // ball administration: ball radius

 void setup() {
   size(680,680);        // set draw area size
   frameRate(framerate); // set animation framerate
   ball_x = 50;     // set the initial ball coordinates
   ball_y = ball_radius; // set the initial ball coordinates
   stroke(#003300);      // set the default shape outline colour
   fill(#0000FF);        // set the default shape fill colour
   pumpkin = loadImage("https://cdn.hackernoon.com/images/6sWrtbrOmsOIbrWzrG88lYfV4ch1-uwb3qrq.png")
 }

 void draw() {
   // compute the ball height for this frame
   float bounce_height = height/2 * abs(sin(PI*frameCount/framerate));
   // because the top of the screen is 0, and the bottom is "height",
   float ball_height = height - (bounce_height+ball_radius);
   // clear the drawing area
   //   background(#FFFFEE);
   // set the new ball y position
   ball_y = (int) (ball_height);
   // draw the ball
   if (ball_y >= 300) {
     background(
       random(255),
       random(255),
       random(255)
     )
   } 
   image(pumpkin, ball_x,ball_y);
 }
</script>

<canvas id='processing'></canvas>
<div><h1>bouncing pumpkin</h1></div>

              
            
!

CSS

              
                
              
            
!

JS

              
                
              
            
!
999px

Console