Pen Settings



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


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


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.


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.


                <canvas id="cvs" width="680px" height="500px" style="background-color:#000;"></canvas>




                var canvas = document.getElementById("cvs");
var ctx = canvas.getContext("2d");
var imgCnt = 25;  // 描画する画像の数
var aryImg = [];  // 画像の情報を格納
var cvsw = 680;   // canvasタグに指定したwidth
var cvsh = 500;   // canvasタグに指定したheight
var imgBaseSizeW = 15;    // 画像の基本サイズ横幅
var imgBaseSizeH = 18.5;  // 画像の基本サイズ立幅

// 画像の読み込み
var img = new Image();
img.src = "";
img.onload = flow_start;

// 画像のパラメーターを設定
function setImagas(){
  for(var i = 0;i < imgCnt;i++){
      "posx": Math.random()*cvsw,     // 初期表示位置x
      "posy": Math.random()*cvsh,     // 初期表示位置y
      "sizew": imgBaseSizeW,          // 画像の幅
      "sizeh": imgBaseSizeH,          // 画像の高さ

// 描画、パラメーターの更新
var idx = 0;
function flow(){
  for(idx = 0;idx < imgCnt;idx++){
    aryImg[idx].posy += 1;
    ctx.drawImage(img, aryImg[idx].posx, aryImg[idx].posy, aryImg[idx].sizew , aryImg[idx].sizeh);
    // 範囲外に描画された画像を上に戻す
    if(aryImg[idx].posy >= cvsh){
      aryImg[idx].posy = 0 - aryImg[idx].sizeh;

function flow_start(){