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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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.


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.

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.


    <script type="text/javascript"src=""></script>
        <script type="text/javascript" src=""></script>
        body {
            margin: 0;
            overflow: hidden;
            background-color: #000000;

<div id="WebGL-output">
<script type="text/javascript">

    function init() {

        const scene = new THREE.Scene();

        const camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 1000);

        const webGLRenderer = new THREE.WebGLRenderer({
           alpha: true  
        //webGLRenderer.setClearColor(new THREE.Color(0x000000));
        webGLRenderer.setSize(window.innerWidth, window.innerHeight);

        camera.position.x = 0;
        camera.position.y = 0;
        camera.position.z = 300;
      // 滑らかにカメラコントローラーを制御する
      const controls = new THREE.OrbitControls(camera, document.body);
      controls.enableDamping = true;
      controls.dampingFactor = 0.2;


        function generate() {
            const canvas = document.createElement('canvas');
            canvas.width = 20;
            canvas.height = 20;

            const context = canvas.getContext('2d');
            const gradient = context.createRadialGradient(canvas.width / 2, canvas.height / 2, 0, canvas.width / 2, canvas.height / 2, canvas.width / 2);
            gradient.addColorStop(0, 'rgba(255,255,255,1)');
            gradient.addColorStop(0.3, 'rgba(0,255,255,1)');
            gradient.addColorStop(0.6, 'rgba(0,0,64,1)');
            gradient.addColorStop(1, 'rgba(0,0,0,1)');
            context.fillStyle = gradient;
            context.fillRect(0, 0, canvas.width, canvas.height);

            const texture = new THREE.Texture(canvas);
            texture.needsUpdate = true;
            return texture;

        function createParticles() {
            const geom = new THREE.Geometry();
            const material = new THREE.PointsMaterial({
                color: 0xffffff,
                size: 3,
                transparent: true,
                blending: THREE.AdditiveBlending,
                map: generate(),//canvasをmapで渡す
                depthWrite: false

            const range = 500;
            for (var i = 0; i < 5000; i++) {
                const particle = new THREE.Vector3(
                  Math.random() * range - range / 2, 
                  Math.random() * range - range / 2,
                  Math.random() * range - range / 2);
                const color = new THREE.Color(0xeffffc);

            cloud = new THREE.Points(geom, material);
   = "particles";

        // 毎フレーム時に実行されるループイベント
        function tick() {

            //cloud.rotation.x += 0.001;
           // cloud.rotation.z += 0.0001;
            camera.position.z += -0.1;
            webGLRenderer.render(scene, camera);// レンダリング
    window.onload = init;