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

              
                <div id="webgl"></div>
<svg class="star" style="display:none; width: 602px;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 602.18 597.4">
	<circle cx="350.66" cy="407.72" r="36.4" />
	<circle cx="437.13" cy="282.42" r="37.56" />
	<circle cx="240.54" cy="156.34" r="34.6" />
	<circle cx="233.92" cy="331.28" r="32.79" />
	<circle cx="97.83" cy="302.82" r="35.23" />
	<circle cx="373.4" cy="242.39" r="32.69" />
	<circle cx="420.27" cy="433.08" r="32.69" />
	<circle cx="219.44" cy="240.34" r="32.78" />
	<circle cx="133.43" cy="548.73" r="32.94" />
	<circle cx="308.72" cy="299.89" r="34.72" />
	<circle cx="237.92" cy="452.1" r="36.18" />
	<circle cx="403.3" cy="529.95" r="34.45" />
	<circle cx="415.85" cy="357.48" r="35.46" />
	<circle cx="137.06" cy="237.3" r="36.14" />
	<circle cx="340.89" cy="175.3" r="36.7" />
	<circle cx="145.84" cy="457.34" r="36.92" />
	<circle cx="311.74" cy="485.23" r="33.53" />
	<circle cx="503.05" cy="243.77" r="32.88" />
	<circle cx="288.92" cy="228.53" r="32.69" />
	<circle cx="34.44" cy="249.26" r="34.44" />
	<circle cx="284.96" cy="78.16" r="39.77" />
	<circle cx="147.42" cy="357.29" r="33.43" />
	<circle cx="275.3" cy="395.16" r="21.88" />
	<circle cx="182.55" cy="298.04" r="23.39" />
	<circle cx="459.86" cy="571" r="26.05" />
	<circle cx="192.11" cy="529.03" r="23.95" />
	<circle cx="195.09" cy="405.93" r="21.81" />
	<circle cx="494.85" cy="312.03" r="22.31" />
	<circle cx="374.55" cy="315.97" r="18.09" />
	<circle cx="233.06" cy="510.38" r="16.05" />
	<circle cx="301.73" cy="363.27" r="14.55" />
	<circle cx="429.57" cy="220.5" r="19.81" />
	<circle cx="552.15" cy="262.14" r="14.55" />
	<circle cx="449.73" cy="501.86" r="14.82" />
	<circle cx="364.29" cy="492.62" r="14.55" />
	<circle cx="585.91" cy="237.46" r="16.27" />
	<circle cx="339.21" cy="350.94" r="16.53" />
	<circle cx="334.82" cy="114.76" r="16.03" />
	<circle cx="258.26" cy="279.92" r="14.55" />
	<circle cx="232.46" cy="383.59" r="14.55" />
	<circle cx="554.51" cy="231.61" r="10.67" />
	<circle cx="288.27" cy="178.54" r="11.02" />
	<circle cx="286.88" cy="12.51" r="12.51" />
	<circle cx="84.78" cy="254.63" r="9.7" />
	<circle cx="375.21" cy="463.52" r="11.54" />
	<circle cx="198.69" cy="486.93" r="11.29" />
	<circle cx="353.84" cy="531.37" r="10.03" />
	<circle cx="289.81" cy="132.42" r="9.7" />
	<circle cx="299.17" cy="437.52" r="10.81" />
	<circle cx="528.17" cy="289.97" r="12.65" />
	<circle cx="112.94" cy="505.73" r="9.7" />
	<circle cx="96.95" cy="586.78" r="10.62" />
	<circle cx="83.85" cy="227.61" r="12.34" />
	<circle cx="467.37" cy="339.5" r="11.55" />
</svg>
<svg class="circle" style="display:none; width: 588px;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 587.41 595.3">
	<circle cx="126.17" cy="223.21" r="30.41" />
	<circle cx="455.91" cy="245.8" r="30.86" />
	<circle cx="118.77" cy="482.83" r="30.73" />
	<circle cx="183.78" cy="148.4" r="38.78" />
	<circle cx="468.8" cy="425.45" r="31.54" />
	<circle cx="223.23" cy="233.32" r="32.07" />
	<circle cx="307.13" cy="424.92" r="30.47" />
	<circle cx="36.04" cy="305.8" r="31.44" />
	<circle cx="195.81" cy="465.7" r="35.48" />
	<circle cx="378.46" cy="197.47" r="30.27" />
	<circle cx="304.04" cy="500.63" r="30.27" />
	<circle cx="399.39" cy="434.33" r="33.44" />
	<circle cx="507.64" cy="351.74" r="34.92" />
	<circle cx="412.19" cy="90.93" r="32.84" />
	<circle cx="397.89" cy="292.16" r="33.78" />
	<circle cx="226.13" cy="81.39" r="34.67" />
	<circle cx="301.03" cy="180.17" r="30.26" />
	<circle cx="423.44" cy="356.24" r="30.2" />
	<circle cx="106.49" cy="293.44" r="30.39" />
	<circle cx="362.71" cy="553.59" r="31.82" />
	<circle cx="304.3" cy="354.58" r="32.39" />
	<circle cx="557.21" cy="302.15" r="30.2" />
	<circle cx="549.56" cy="237.16" r="30.23" />
	<circle cx="52.57" cy="228.6" r="31.47" />
	<circle cx="120.91" cy="108.36" r="30.75" />
	<circle cx="140.54" cy="373.07" r="30.89" />
	<circle cx="176.8" cy="305.45" r="30.99" />
	<circle cx="477" cy="150.74" r="32.62" />
	<circle cx="64.48" cy="414.88" r="30.23" />
	<circle cx="229.18" cy="533" r="32.59" />
	<circle cx="324.71" cy="41.84" r="30.85" />
	<circle cx="290.67" cy="250.11" r="32.43" />
	<circle cx="442.9" cy="489.9" r="31.48" />
	<circle cx="335.48" cy="110.96" r="33.29" />
	<circle cx="245.03" cy="316.75" r="32.92" />
	<circle cx="228.12" cy="400.89" r="31.94" />
	<circle cx="87.34" cy="170.32" r="30.2" />
	<circle cx="292.65" cy="565.1" r="30.2" />
	<circle cx="331.06" cy="293.21" r="20.7" />
	<circle cx="162.39" cy="70.29" r="20.55" />
	<circle cx="519.75" cy="458.88" r="22.27" />
	<circle cx="71.32" cy="357.07" r="22.98" />
	<circle cx="365.68" cy="489.8" r="21.83" />
	<circle cx="249.65" cy="146.71" r="21.61" />
	<circle cx="463.83" cy="301.24" r="20.14" />
	<circle cx="359.54" cy="338.49" r="20.14" />
	<circle cx="538.93" cy="181.9" r="21.05" />
	<circle cx="256.33" cy="462.19" r="20.14" />
	<circle cx="553.29" cy="398.63" r="20.6" />
	<circle cx="417.14" cy="149.69" r="21.13" />
	<circle cx="130.49" cy="428.2" r="20.14" />
	<circle cx="171.45" cy="534.1" r="20.14" />
	<circle cx="507.31" cy="278.04" r="20.22" />
	<circle cx="38.39" cy="177.9" r="14.33" />
	<circle cx="225.22" cy="28.3" r="13.44" />
	<circle cx="463.35" cy="94.44" r="13.44" />
	<circle cx="271.5" cy="112.37" r="14.09" />
	<circle cx="173.99" cy="210.29" r="14.12" />
	<circle cx="33.93" cy="376.99" r="13.44" />
	<circle cx="265.75" cy="41.83" r="16.33" />
	<circle cx="193.29" cy="354.07" r="15.35" />
	<circle cx="438.05" cy="184.51" r="13.94" />
	<circle cx="492.86" cy="207.42" r="17.42" />
	<circle cx="507.13" cy="109.53" r="13.44" />
	<circle cx="412.9" cy="555.99" r="13.44" />
	<circle cx="167.56" cy="416.3" r="13.79" />
	<circle cx="398.62" cy="512.95" r="13.44" />
	<circle cx="350.71" cy="259.37" r="13.44" />
	<circle cx="238.5" cy="185.17" r="13.44" />
	<circle cx="397.3" cy="41.02" r="14.24" />
	<circle cx="83.31" cy="454.89" r="8.99" />
	<circle cx="484.71" cy="468.08" r="8.96" />
	<circle cx="561.5" cy="362.14" r="11.81" />
	<circle cx="372.5" cy="23.32" r="11.23" />
	<circle cx="213.74" cy="279.83" r="8.96" />
	<circle cx="517.27" cy="403.84" r="10.8" />
	<circle cx="159.33" cy="253.74" r="9.66" />
	<circle cx="185.1" cy="567.26" r="9.76" />
	<circle cx="91.74" cy="251.62" r="8.96" />
	<circle cx="64.99" cy="129.08" r="11.71" />
	<circle cx="267.83" cy="9.3" r="9.3" />
	<circle cx="344.27" cy="387.23" r="14.22" />
	<circle cx="329.99" cy="213.58" r="8.96" />
	<circle cx="403.24" cy="243.76" r="9.92" />
	<circle cx="297.45" cy="77.41" r="8.96" />
	<circle cx="376.87" cy="249.18" r="9.07" />
	<circle cx="378.86" cy="134.8" r="10.25" />
	<circle cx="383.66" cy="387.29" r="11.16" />
	<circle cx="133.98" cy="530.2" r="12.53" />
	<circle cx="523.99" cy="141.7" r="10.23" />
	<circle cx="344.83" cy="448.42" r="8.96" />
	<circle cx="365.7" cy="155.12" r="8.96" />
	<circle cx="134.52" cy="167.26" r="8.96" />
	<circle cx="366.34" cy="75.18" r="8.96" />
	<circle cx="8.96" cy="269.36" r="8.96" />
</svg>
<svg class="square" style="display:none; width: 602px;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 602 602">
	<circle cx="73.04" cy="173.09" r="34.64" />
	<circle cx="309.84" cy="544.15" r="30.31" />
	<circle cx="544.21" cy="328.69" r="32.13" />
	<circle cx="507.31" cy="212.76" r="32.11" />
	<circle cx="77.46" cy="369.63" r="32.7" />
	<circle cx="87.51" cy="103.19" r="30.53" />
	<circle cx="512.84" cy="400.07" r="31.36" />
	<circle cx="182.12" cy="515.17" r="35.5" />
	<circle cx="144.76" cy="377.82" r="30.1" />
	<circle cx="304.16" cy="119.92" r="31.32" />
	<circle cx="541.47" cy="533.35" r="35.54" />
	<circle cx="268.8" cy="62.24" r="31.34" />
	<circle cx="453.36" cy="515.12" r="30.3" />
	<circle cx="237.56" cy="363.9" r="31.36" />
	<circle cx="156.21" cy="221.53" r="35.97" />
	<circle cx="324.16" cy="442.29" r="30.22" />
	<circle cx="399.94" cy="324.68" r="31.29" />
	<circle cx="483.03" cy="150.1" r="30.1" />
	<circle cx="320.75" cy="237.66" r="30.26" />
	<circle cx="425.36" cy="37.96" r="31.83" />
	<circle cx="197.91" cy="443.48" r="30.13" />
	<circle cx="411.11" cy="128.24" r="30.35" />
	<circle cx="566.58" cy="54.85" r="33.39" />
	<circle cx="61.13" cy="525.72" r="30.96" />
	<circle cx="496.13" cy="44.58" r="32.5" />
	<circle cx="72.11" cy="252.74" r="35.58" />
	<circle cx="188.37" cy="132.17" r="32.54" />
	<circle cx="471.29" cy="300.35" r="35.74" />
	<circle cx="260" cy="182.77" r="30.19" />
	<circle cx="39.5" cy="437.59" r="39.5" />
	<circle cx="404.77" cy="222.6" r="30.88" />
	<circle cx="156.74" cy="52.93" r="35.44" />
	<circle cx="139.63" cy="307.93" r="34.98" />
	<circle cx="382.84" cy="528.58" r="36.49" />
	<circle cx="359.92" cy="52.04" r="30.1" />
	<circle cx="564.38" cy="459.95" r="34.64" />
	<circle cx="43.88" cy="30.29" r="30.29" />
	<circle cx="316.42" cy="365.47" r="30.16" />
	<circle cx="109.27" cy="472.28" r="32.23" />
	<circle cx="453.32" cy="430.51" r="30.5" />
	<circle cx="34.98" cy="315.55" r="31.08" />
	<circle cx="249.96" cy="495.6" r="30.1" />
	<circle cx="295.65" cy="298.42" r="30.48" />
	<circle cx="207.68" cy="270.55" r="30.1" />
	<circle cx="241.18" cy="563.83" r="33.69" />
	<circle cx="118.41" cy="558.63" r="30.1" />
	<circle cx="570.74" cy="169.04" r="31.26" />
	<circle cx="440.72" cy="574.48" r="24.39" />
	<circle cx="570.21" cy="271.15" r="26.01" />
	<circle cx="383.65" cy="378.65" r="20.08" />
	<circle cx="357.78" cy="155.57" r="22.55" />
	<circle cx="573.91" cy="391.59" r="25.3" />
	<circle cx="46.17" cy="580.12" r="20.46" />
	<circle cx="22.33" cy="214.43" r="22.25" />
	<circle cx="489" cy="563.7" r="20.08" />
	<circle cx="355.35" cy="282.46" r="21.35" />
	<circle cx="521.03" cy="101.64" r="20.6" />
	<circle cx="126.66" cy="146.81" r="20.08" />
	<circle cx="506.47" cy="474.52" r="20.08" />
	<circle cx="34.78" cy="85.51" r="20.08" />
	<circle cx="431.39" cy="368.32" r="17.5" />
	<circle cx="578.76" cy="105.18" r="13.39" />
	<circle cx="420.46" cy="273.42" r="13.5" />
	<circle cx="13.93" cy="540.2" r="13.42" />
	<circle cx="513.44" cy="266.26" r="13.47" />
	<circle cx="86.23" cy="305.94" r="13.46" />
	<circle cx="420.78" cy="176" r="13.39" />
	<circle cx="307.92" cy="190.73" r="13.39" />
	<circle cx="458.6" cy="92.55" r="15.49" />
	<circle cx="388.99" cy="423.69" r="20.29" />
	<circle cx="104" cy="421.94" r="13.39" />
	<circle cx="217.59" cy="70.36" r="15.52" />
	<circle cx="188.49" cy="355.72" r="13.39" />
	<circle cx="338.85" cy="488.63" r="13.39" />
	<circle cx="18.32" cy="373.31" r="18.32" />
	<circle cx="263.95" cy="255.01" r="18.27" />
	<circle cx="403.35" cy="459.73" r="13.51" />
	<circle cx="320.49" cy="22.38" r="14.24" />
	<circle cx="584.95" cy="571.72" r="14.58" />
	<circle cx="494.75" cy="349.13" r="13.39" />
	<circle cx="255.15" cy="442.64" r="18.11" />
	<circle cx="13.69" cy="136.57" r="13.49" />
	<circle cx="456.13" cy="193.18" r="15.69" />
	<circle cx="306.47" cy="488" r="13.79" />
	<circle cx="147.66" cy="429.95" r="16.91" />
	<circle cx="239.01" cy="115" r="14.93" />
	<circle cx="215.34" cy="217.5" r="16.61" />
	<circle cx="288.06" cy="404.87" r="13.39" />
	<circle cx="194.76" cy="395.06" r="13.39" />
	<circle cx="340.37" cy="192.63" r="13.39" />
	<circle cx="105.59" cy="36.14" r="13.39" />
	<circle cx="191.29" cy="583.25" r="13.67" />
	<circle cx="586.11" cy="228.3" r="14.69" />
	<circle cx="137.36" cy="106.46" r="14.43" />
	<circle cx="247.46" cy="16.78" r="13.88" />
	<circle cx="19.66" cy="506.07" r="9.94" />
	<circle cx="261.61" cy="135.32" r="8.93" />
	<circle cx="406.88" cy="83.53" r="9.56" />
	<circle cx="346.99" cy="99.19" r="11.27" />
	<circle cx="367.04" cy="468.49" r="15.02" />
	<circle cx="260.48" cy="411.02" r="8.95" />
	<circle cx="23.01" cy="259.08" r="8.93" />
	<circle cx="171.31" cy="564.22" r="8.93" />
	<circle cx="592.72" cy="503.75" r="9.28" />
	<circle cx="236.4" cy="143.74" r="8.93" />
	<circle cx="215.02" cy="170.24" r="8.93" />
	<circle cx="393.17" cy="177.56" r="9.27" />
	<circle cx="346.58" cy="332.25" r="9.7" />
	<circle cx="23.58" cy="162.14" r="8.93" />
	<circle cx="277.52" cy="342.48" r="8.99" />
	<circle cx="586.26" cy="309.89" r="8.93" />
	<circle cx="531.37" cy="14.35" r="8.93" />
	<circle cx="199.26" cy="191.53" r="8.93" />
	<circle cx="313.61" cy="55.29" r="9" />
	<circle cx="474.62" cy="375.77" r="8.93" />
	<circle cx="281.47" cy="462.83" r="10.07" />
	<circle cx="393.49" cy="278.44" r="8.93" />
	<circle cx="191.9" cy="11.28" r="11.28" />
	<circle cx="474.8" cy="247.11" r="10.19" />
	<circle cx="372.74" cy="580.1" r="11.01" />
	<circle cx="560.6" cy="586.54" r="8.93" />
	<circle cx="429.32" cy="477.98" r="8.93" />
	<circle cx="535.21" cy="134.53" r="10.22" />
	<circle cx="486.5" cy="101.87" r="8.93" />
	<circle cx="306.69" cy="588.28" r="8.93" />
	<circle cx="417.68" cy="397.49" r="9.73" />
</svg>
<svg class="hexagon" style="display:none; width: 609px;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 609.79 676.83">
	<circle cx="439.12" cy="199.97" r="37.92" />
	<circle cx="58.65" cy="465.18" r="34.63" />
	<circle cx="314.7" cy="199.59" r="32.65" />
	<circle cx="388.43" cy="125.3" r="32.33" />
	<circle cx="399.18" cy="322.12" r="37.59" />
	<circle cx="310.93" cy="305.54" r="33.81" />
	<circle cx="114.43" cy="170.27" r="34.49" />
	<circle cx="173.71" cy="378.08" r="33.81" />
	<circle cx="314.12" cy="80.24" r="33.07" />
	<circle cx="243.86" cy="209.42" r="33.87" />
	<circle cx="328" cy="440.14" r="32.13" />
	<circle cx="452.78" cy="439.32" r="33.42" />
	<circle cx="524.47" cy="231" r="32.54" />
	<circle cx="250.37" cy="522.78" r="33.52" />
	<circle cx="239.48" cy="452.98" r="32.12" />
	<circle cx="268.96" cy="599.3" r="39.58" />
	<circle cx="185.43" cy="556.92" r="32.78" />
	<circle cx="73.24" cy="391.98" r="34.5" />
	<circle cx="504.17" cy="368.67" r="34.13" />
	<circle cx="505.9" cy="501.15" r="32.45" />
	<circle cx="110.9" cy="529.46" r="32.61" />
	<circle cx="568.48" cy="424.97" r="32.38" />
	<circle cx="283.41" cy="387.02" r="32.23" />
	<circle cx="41.09" cy="212.2" r="33.6" />
	<circle cx="403.13" cy="513.4" r="35.47" />
	<circle cx="225.55" cy="104.66" r="32.16" />
	<circle cx="224.15" cy="291.73" r="33.37" />
	<circle cx="95.23" cy="320.82" r="33.79" />
	<circle cx="466.84" cy="271.87" r="32.54" />
	<circle cx="565.49" cy="332.37" r="32.12" />
	<circle cx="489.36" cy="141.72" r="34" />
	<circle cx="344.66" cy="625.67" r="33.4" />
	<circle cx="166.1" cy="250.11" r="33.06" />
	<circle cx="338.11" cy="550.15" r="34.22" />
	<circle cx="135.93" cy="464.38" r="32.12" />
	<circle cx="185.51" cy="161.62" r="32.12" />
	<circle cx="272.14" cy="37.7" r="21.7" />
	<circle cx="393.39" cy="446.76" r="21.43" />
	<circle cx="31.14" cy="297.21" r="23.57" />
	<circle cx="359.16" cy="390.57" r="21.43" />
	<circle cx="363.64" cy="232.7" r="21.43" />
	<circle cx="430.63" cy="578.64" r="22.21" />
	<circle cx="191.53" cy="498.03" r="21.43" />
	<circle cx="575.58" cy="483.35" r="21.43" />
	<circle cx="473.09" cy="550.03" r="21.43" />
	<circle cx="99.35" cy="258.02" r="22.26" />
	<circle cx="164.53" cy="314.79" r="25.15" />
	<circle cx="575.13" cy="269.18" r="19.39" />
	<circle cx="181.49" cy="440.17" r="14.47" />
	<circle cx="276.51" cy="132.88" r="15.22" />
	<circle cx="448.96" cy="106.55" r="14.56" />
	<circle cx="348.01" cy="157.41" r="14.29" />
	<circle cx="540.73" cy="181.35" r="14.7" />
	<circle cx="243.48" cy="340.71" r="14.29" />
	<circle cx="445.83" cy="379.59" r="17.53" />
	<circle cx="572.8" cy="212.26" r="14.29" />
	<circle cx="231.59" cy="401.7" r="14.77" />
	<circle cx="570.64" cy="164.59" r="14.59" />
	<circle cx="361.62" cy="58.22" r="14.29" />
	<circle cx="350.58" cy="498" r="14.29" />
	<circle cx="121.84" cy="366.76" r="14.29" />
	<circle cx="413.49" cy="252.04" r="15.11" />
	<circle cx="164.42" cy="101.08" r="18.47" />
	<circle cx="310.13" cy="494.67" r="20.25" />
	<circle cx="124.13" cy="412.36" r="15.32" />
	<circle cx="307.24" cy="251.84" r="15.01" />
	<circle cx="499.42" cy="312.18" r="14.29" />
	<circle cx="359.57" cy="281.3" r="14.29" />
	<circle cx="458.31" cy="323.97" r="15.25" />
	<circle cx="337.1" cy="351.74" r="14.29" />
	<circle cx="402.25" cy="608.92" r="14.29" />
	<circle cx="34.77" cy="356.69" r="12.7" />
	<circle cx="97.24" cy="434.73" r="9.53" />
	<circle cx="511.49" cy="437.67" r="19.49" />
	<circle cx="384.88" cy="570.88" r="11.94" />
	<circle cx="414.08" cy="375.14" r="9.53" />
	<circle cx="65.58" cy="160.8" r="10.27" />
	<circle cx="25.32" cy="413.97" r="9.62" />
	<circle cx="331.41" cy="35.22" r="9.66" />
	<circle cx="338.08" cy="123.77" r="11.61" />
	<circle cx="223.04" cy="51.63" r="10.25" />
	<circle cx="543.33" cy="149.8" r="11.47" />
	<circle cx="25.11" cy="258.19" r="10.08" />
	<circle cx="262.68" cy="163.26" r="10.97" />
	<circle cx="40.02" cy="520.08" r="14.39" />
	<circle cx="209.97" cy="600.6" r="12.33" />
	<circle cx="526.88" cy="297.14" r="12.02" />
	<circle cx="305.96" cy="137.07" r="9.53" />
	<circle cx="266.27" cy="267.47" r="10.24" />
	<circle cx="51.26" cy="259.25" r="9.53" />
	<circle cx="386.87" cy="195.35" r="9.53" />
	<circle cx="536.95" cy="460.23" r="9.53" />
	<circle cx="361.51" cy="188.45" r="10.45" />
	<circle cx="93.49" cy="221.7" r="9.53" />
	<circle cx="394.04" cy="406.34" r="11.86" />
	<circle cx="293.93" cy="647.31" r="9.53" />
	<circle cx="260.55" cy="73.76" r="9.53" />
</svg>

<!-- vertexShader -->
<script id="js-vertex-shader" type="x-shader/x-vertex">
attribute vec3 position;
attribute float radius;
attribute vec3 starPosition;
attribute float starRadius;
attribute vec3 squarePosition;
attribute float squareRadius;
attribute vec3 hexagonPosition;
attribute float hexagonRadius;
uniform float u_switch_01;
uniform float u_switch_02;
uniform float u_switch_03;
uniform float u_switch_04;
uniform mat4 modelViewMatrix;
uniform mat4 projectionMatrix;

void main() {
    vec3 toStarPosition = mix(position, starPosition, u_switch_01);
    vec3 toSquarePosition = mix(toStarPosition, squarePosition, u_switch_02);
    vec3 toHexagonPosition = mix(toSquarePosition, hexagonPosition, u_switch_03);
    vec3 loopInitPosition = mix(toHexagonPosition, position, u_switch_04);

    float toStarRadius = mix(radius, starRadius, u_switch_01);
    float toSquareRadius = mix(toStarRadius, squareRadius, u_switch_02);
    float toHexagonRadius = mix(toSquareRadius, hexagonRadius, u_switch_03);
    float loopInitRadius = mix(toHexagonRadius, radius, u_switch_04);

    gl_Position = projectionMatrix * modelViewMatrix * vec4(loopInitPosition, 1.0);
    gl_PointSize = loopInitRadius;
}
</script>

<!-- fragmentShader -->
<script id="js-fragment-shader" type="x-shader/x-fragment">
precision mediump float;

uniform vec3 u_color;

void main() {
    vec2 temp = gl_PointCoord - vec2(0.5);
    float f = dot(temp, temp);
    if (f > 0.25 ) {
        discard;
    }
    gl_FragColor = vec4(u_color, 1.0);
}
</script>
              
            
!

CSS

              
                * {
	margin: 0;
	padding: 0;
}

html,body{
  width: 100%;
  height: 100%;
  overflow: hidden;
}

              
            
!

JS

              
                /**
 * Fisher-Yates のシャッフルアルゴリズムを用いた配列のシャッフル
 */
const shuffleArray = (sourceArray) => {
	const array = sourceArray.concat();
	const arrayLength = array.length;
	for (let i = arrayLength - 1.0; i >= 0; i--) {
		const randomIndex = Math.floor(Math.random() * (i + 1.0));
		[array[i], array[randomIndex]] = [array[randomIndex], array[i]];
	}

	return array;
};

const maxLength = 126;

const getSvgCircleAttribute = (viewBox, target) => {
	const targetSvgCircle = shuffleArray([...target]);
	const particleScenePosition = [];
	const particleSceneRadius = [];

	for (let i = 0; i < targetSvgCircle.length; i++) {
		let x =(((Number(targetSvgCircle[i].attributes.cx.value) / viewBox.width) * 2.0 - 1.0) * viewBox.width) / 2;
		let y =(-((Number(targetSvgCircle[i].attributes.cy.value) / viewBox.height) * 2.0 - 1.0) * viewBox.height) / 2;
		let z = 0;
		let r = Number(targetSvgCircle[i].attributes.r.value) * 4.0;
		
		//ligブログのデモ用にサイズを小さくする。
		x *= 0.5;
		y *= 0.5;
		r *= 0.5;

		particleScenePosition.push(x, y, z);
		particleSceneRadius.push(r);
	}

	for (let i = 0; i < maxLength - targetSvgCircle.length; i++) {
		const x = ((Math.random() * 2.0 - 1.0) * viewBox.width) / 5;
		const y = (-(Math.random() * 2.0 - 1.0) * viewBox.height) / 5;
		const z = 0;
		const r = 0;
		particleScenePosition.push(x, y, z);
		particleSceneRadius.push(r);
	}

	return {
		position: particleScenePosition,
		radius: particleSceneRadius
	};
};

class Stage {
	constructor() {
		this.renderParam = {
			clearColor: 0x000000,
			width: window.innerWidth,
			height: window.innerHeight
		};
		this.cameraParam = {
			fov: 45,
			near: 0.1,
			far: 100,
			lookAt: new THREE.Vector3(0, 0, 0),
			x: 0,
			y: 0,
			z: 1.0
		};

		this.scene = null;
		this.camera = null;
		this.renderer = null;
		this.isInitialized = false;
	}

	init() {
		this._setScene();
		this._setRender();
		this._setCamera();
	}

	_setScene() {
		this.scene = new THREE.Scene();
	}

	_setRender() {
		this.renderer = new THREE.WebGLRenderer();
		this.renderer.setPixelRatio(2.0);
		this.renderer.setClearColor(new THREE.Color(this.renderParam.clearColor));
		this.renderer.setSize(this.renderParam.width, this.renderParam.height);
		const wrapper = document.querySelector("#webgl");
		wrapper.appendChild(this.renderer.domElement);
	}

	_setCamera() {
		if (!this.isInitialized) {
			this.camera = new THREE.PerspectiveCamera(
				0,
				0,
				this.cameraParam.near,
				this.cameraParam.far
			);

			this.camera.position.set(
				this.cameraParam.x,
				this.cameraParam.y,
				this.cameraParam.z
			);
			this.camera.lookAt(this.cameraParam.lookAt);

			this.isInitialized = true;
		}

		const windowWidth = window.innerWidth;
		const windowHeight = window.innerHeight;
		this.camera.aspect = windowWidth / windowHeight;

		this.camera.fov =
			THREE.MathUtils.radToDeg(
				Math.atan(windowWidth / this.camera.aspect / (2 * this.camera.position.z))
			) * 2.0;
		this.camera.updateProjectionMatrix();
		this.renderer.setSize(windowWidth, windowHeight);
	}

	_render() {
		this.renderer.render(this.scene, this.camera);
	}

	onResize() {
		this._setCamera();
	}

	onRaf() {
		this._render();
	}
}

class Particle {
	constructor(stage) {
		this.duration = 1.4;
		this.ease = "power2.inOut";
		this.color = "#ffffff";
		this.stage = stage;
	}

	init() {
		this._setSvgData();
		this._setMesh();
	}

	_setSvgData() {
		this.circle = document.querySelector(".circle");
		this.circleViewBox = this.circle.viewBox.baseVal;
		this.circleDom = this.circle.querySelectorAll("circle");
		this.circleObject = getSvgCircleAttribute(this.circleViewBox, this.circleDom);

		this.star = document.querySelector(".star");
		this.starViewBox = this.star.viewBox.baseVal;
		this.starDom = this.star.querySelectorAll("circle");
		this.starObject = getSvgCircleAttribute(this.starViewBox, this.starDom);

		this.square = document.querySelector(".square");
		this.squareViewBox = this.square.viewBox.baseVal;
		this.squareDom = this.square.querySelectorAll("circle");
		this.squareObject = getSvgCircleAttribute(this.squareViewBox, this.squareDom);

		this.hexagon = document.querySelector(".hexagon");
		this.hexagonViewBox = this.hexagon.viewBox.baseVal;
		this.hexagonDom = this.hexagon.querySelectorAll("circle");
		this.hexagonObject = getSvgCircleAttribute(
			this.hexagonViewBox,
			this.hexagonDom
		);
	}

	_setMesh() {
		const geometry = new THREE.BufferGeometry();
		const circlePosition = new THREE.BufferAttribute(
			new Float32Array(this.circleObject.position),
			3
		);
		const circleRadius = new THREE.BufferAttribute(
			new Float32Array(this.circleObject.radius),
			1
		);
		const starPosition = new THREE.BufferAttribute(
			new Float32Array(this.starObject.position),
			3
		);
		const starRadius = new THREE.BufferAttribute(
			new Float32Array(this.starObject.radius),
			1
		);
		const squarePosition = new THREE.BufferAttribute(
			new Float32Array(this.squareObject.position),
			3
		);
		const squareRadius = new THREE.BufferAttribute(
			new Float32Array(this.squareObject.radius),
			1
		);
		const hexagonPosition = new THREE.BufferAttribute(
			new Float32Array(this.hexagonObject.position),
			3
		);
		const hexagonRadius = new THREE.BufferAttribute(
			new Float32Array(this.hexagonObject.radius),
			1
		);
		geometry.setAttribute("position", circlePosition);
		geometry.setAttribute("radius", circleRadius);
		geometry.setAttribute("starPosition", starPosition);
		geometry.setAttribute("starRadius", starRadius);
		geometry.setAttribute("squarePosition", squarePosition);
		geometry.setAttribute("squareRadius", squareRadius);
		geometry.setAttribute("hexagonPosition", hexagonPosition);
		geometry.setAttribute("hexagonRadius", hexagonRadius);

		const material = new THREE.RawShaderMaterial({
			vertexShader: document.querySelector("#js-vertex-shader").textContent,
			fragmentShader: document.querySelector("#js-fragment-shader").textContent,
			uniforms: {
				u_switch_01: { type: "f", value: 0.0 },
				u_switch_02: { type: "f", value: 0.0 },
				u_switch_03: { type: "f", value: 0.0 },
				u_switch_04: { type: "f", value: 0.0 },
				u_color: { type: "v3", value: new THREE.Color(this.color) }
			}
		});
		this.mesh = new THREE.Points(geometry, material);
		this.stage.scene.add(this.mesh);
	}

	_setLoop(number) {
		switch (number) {
			case 0:
				gsap.to(this.mesh.material.uniforms.u_switch_01, {
					duration: this.duration,
					ease: this.ease,
					value: 1.0
				});
				break;
			case 1:
				gsap.to(this.mesh.material.uniforms.u_switch_02, {
					duration: this.duration,
					ease: this.ease,
					value: 1.0
				});
				break;
			case 2:
				gsap.to(this.mesh.material.uniforms.u_switch_03, {
					duration: this.duration,
					ease: this.ease,
					value: 1.0
				});
				break;
			case 3:
				gsap.to(this.mesh.material.uniforms.u_switch_04, {
					duration: this.duration,
					ease: this.ease,
					value: 1.0,
					onComplete: () => {
						gsap.set(this.mesh.material.uniforms.u_switch_01, {
							value: 0.0
						});
						gsap.set(this.mesh.material.uniforms.u_switch_02, {
							value: 0.0
						});
						gsap.set(this.mesh.material.uniforms.u_switch_03, {
							value: 0.0
						});
						gsap.set(this.mesh.material.uniforms.u_switch_04, {
							value: 0.0
						});
					}
				});
				break;
		}
	}

	_render() {
		//
	}

	onResize() {
		//
	}

	onRaf() {
		this._render();
	}
}

class Webgl {
	constructor() {
		const stage = new Stage();
		stage.init();

		const particle = new Particle(stage);
		particle.init();

		window.addEventListener("resize", () => {
			stage.onResize();
			particle.onResize();
		});

		const _raf = () => {
			window.requestAnimationFrame(() => {
				_raf();

				stage.onRaf();
				particle.onRaf();
			});
		};
		_raf();

		const allDuration = 3.0;
		let currentNum = 0;

		const _moveChangeSlide = () => {
			if (currentNum > 2) {
				currentNum = 0;
			} else {
				currentNum++;
			}
		};

		const _autoChangeSlide = () => {
			gsap
				.to(
					{},
					{
						ease: "none",
						duration: allDuration,
						repeat: -1.0
					}
				)
				.eventCallback("onRepeat", () => {
					particle._setLoop(currentNum);
					_moveChangeSlide();
				});
		};
		_autoChangeSlide();
	}
}

new Webgl();

              
            
!
999px

Console