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

              
                
<style type="text/css">
body{
background:url(https://www.melike.biz/wp/wp-content/uploads/2018/06/6-2.jpg) no-repeat #000;
width:100%;
text-align: center;
background-size: cover;
}</style>


</head>
<body>
<script type="text/javascript"><!--

(function(){  //即時関数で囲んでグローバル変数を消すため、この行はこのままで

//花火のスタート時の花火の単色の色指定。増減可能。色を順番に'●',と区切って、いくつでも並べる。最後の ] の前には ,(カンマ) 無し
var sColors=['#ffa500','#0f0','#faf','#fff000','#fff'];

//花火が開いた後に変化する光の種類。1個の光点が色変化します。増減可能
var Colors=['#f00','#0f0','#fff','#f0f','#ffa500','#ff0','#0f0','#fff','#f0f'];

var wh=5;            //花火の光点のサイズ。divの縦幅横幅。単位px
var inZ=-1;          //画像や文章の上に流れるなら 1 。下に隠れるなら -1
var Pos="absolute";  //スクロールで移動するか? 固定:fixed  移動:absolute
var spd=100;         //花火が開いていく速度。数値が小さいほど速い

var rscolor=sColors[Math.floor(Math.random()*sColors.length)];
var w=window.innerWidth-18-wh;
var h=window.innerHeight-18-wh;
var staY=h, startY=200, startX=w/2;
var radius =0, last_radius=w/8;//原本w/8。花火の大きさ
var c_count=0, i=0, deviatY=1, mp=Math.PI*2, f=[], tp;
var sss="";
for(i=0;i<mp;i=i+0.3){
sss +="<div style='position:"+Pos+";width:"+wh+"px;height:"+wh+"px;background:"+rscolor+";top:"+staY+"px;left:"+startX+"px;border-radius:50%;z-index:"+inZ+";'id='bon"+i+"'></div>";
}
document.write(sss);
function uchiage(){
if(startY < staY){staY-=10;for(i=0;i<mp;i=i+0.3){ f[i].top=staY+tp+"px";} setTimeout(uchiage,50);}
else{radius=20; hanabi();}
}

function hanabi(){
if(last_radius > radius){
    radius +=10;
    for(i=0;i<mp;i=i+0.3){
        var pointX=startX + Math.cos(i)*radius;
    (deviatY===0.3) ? katamuki=(pointX-startX)*0.4 : katamuki=0;
        var pointY=startY + Math.sin(i)*radius*deviatY+katamuki;
    f[i].top=pointY+tp+"px"; f[i].left=pointX+"px";
    }
    setTimeout(hanabi,spd);
}else if(c_count<300){
    for(i=0;i<mp;i=i+0.3){
    var rcolor=Colors[Math.floor(Math.random()*Colors.length)];
    f[i].backgroundColor=rcolor; c_count++;
    }
    setTimeout(hanabi,spd);
}else{
    rscolor=sColors[Math.floor(Math.random()*sColors.length)];
    radius=20; c_count=0;
    var scrX=w-last_radius*2;
    startX=Math.floor(Math.random()*scrX)+last_radius;
    startY=Math.random()*last_radius+last_radius;
    staY=h-20;
(!(Math.floor(Math.random()*3)))?deviatY=0.3:deviatY=1;//原本3は楕円形の花火が出現する確率。数値が小さいと多くなる
    for(i=0;i<mp;i=i+0.3){
    f[i].backgroundColor=rscolor; f[i].top=staY+tp+"px"; f[i].left=startX+"px";
}
uchiage();
}
}

function init(){
tp=window.pageYOffset;
for(i=0;i<mp;i=i+0.3){ f[i]=document.getElementById("bon"+i).style; }
uchiage();
}
init();
})();</script>


</body>
</html>



              
            
!

CSS

              
                

              
            
!

JS

              
                


              
            
!
999px

Console