css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
                <div class="abeamer-story" id=story>
    <div class="abeamer-scene" id=scene1>
      <div id=star-container></div>
      <div id=svg-container></div>
      <div id=text-container>
        <div id=A>A</div>
        <div id=Beamer>Beamer</div>
      </div>
      <div id=ufo-container>
        <img id=ufo src="https://www.abeamer.com/files/by-date/2018/08/abeamer-cover/assets/pixabay/ufo-2121470_1280.png">
      </div>
    </div>
  </div>

            
          
!
            
              // YouTube 480p
$abeamer-width: 854;
$abeamer-height: 480;


// Twitter cover size
// $abeamer-width: 1500;
// $abeamer-height: 500;


body,
html,
.abeamer-story,
.abeamer-scene {
  width: $abeamer-width + px;
  height: $abeamer-height + px;
}

@font-face {
  font-family: 'Open Sans';
  font-style: bold;
  src: url("https://www.abeamer.com/files/by-date/2018/08/abeamer-cover/assets/fonts/Open_Sans/OpenSans-Bold.ttf");
}

.abeamer-scene {
  background: #160a20;
  font-family: 'Open Sans';
  font-weight: bold;
  letter-spacing: 1px;
  font-size: 160px;
  color: white;
}

$ufo-width: 360;

svg {
  position: absolute;
  left: 0;
  top: 0;
  width: $abeamer-width + px;
  height: $abeamer-height + px;
}

#text-container {
  display: flex;
  flex-direction: column-reverse;
  height: 100%;

  #A {
    position: relative;
    text-align: center;
    order: 1;
    margin-bottom: -46px;
    font-size: 100%;
  }

  #Beamer {
    position: relative;
    text-align: center;
    font-size: 80%;
    margin-bottom: 0px;
  }
}

#ufo-container {
  position: fixed;
  width: 100%;
  height: 100%;
  left: 0;
  top: 0;
  text-align: left;

  #ufo {
    margin-left: - $ufo-width + px;
    width: $ufo-width + px;
  }
}

#star-container {
  position: fixed;
  img {
    position: absolute;
  }
}
            
          
!
            
              // twitter: https://twitter.com/ABeamerJS
// website: https://www.abeamer.com

/* ---------------
* To generate a png file sequence, gif or .mp4 file of your work:
* 1. Install ABeamer, read the instructions: https://www.abeamer.com/#get-started
* 2. Create a project using abeamer: abeamer create foo
* 3. Copy the:
*     - scss code to css/main.scss   (compile it)
*     - ts code to js/main.ts or if it's javascript to js/main.js
*     - html code inside the story to code inside the story in index.html
*     - the dimensions code at the top of scss code to abeamer.ini
* 4. To generate a file sequence: abeamer render foo
* 5. To generate an animated gif file (after step 4): abeamer gif foo
* 6. To generate a .mp4 file (after step 4): abeamer movie foo
* ---------------- */

$(window).on("load", () => {

  const story = ABeamer.createStory(/*FPS:*/10);

  // ------------------------------------------------------------------------
  //                               Plots
  // ------------------------------------------------------------------------

  const duration = 1;
  const imgSize = 360;
  const w = story.width;
  const h = story.height;
  const topBound = 80;        // beam upper y-position
  const upperOpening = 100;   // beam upper aperture size
  const lowerOpening = 600;   // beam lower aperture size

  const svgContent: string[] = []; // svg code to be iterated
  
  const yStart = topBound + 10;

  // the code bellow is not the most efficient if you want to render in a remote machine by teleporting,
  // but it works well for local machine rendering.
  for (let i = yStart; i < (h - 30); i++) {

    const open = ((i - yStart) / (h - yStart)) * (lowerOpening - upperOpening)
      + upperOpening;

    svgContent.push(
      `
    <svg xmlns="http://www.w3.org/2000/svg">
    <defs>
      <linearGradient id="grad" gradientUnits="userSpaceOnUse" x1="50%" y1="0%" x2="50%" y2="100%">
        <stop style="stop-color:#ffff26ad;stop-opacity:1;" offset="0%"></stop>
        <stop style="stop-color:#dce73a58;stop-opacity:0.2;" offset="100%"></stop>
      </linearGradient>
    </defs>
    <path fill="url(#grad)" d="`
      + `M${(w - upperOpening) / 2},${topBound} `
      + `L${(w + upperOpening) / 2},${topBound} `
      + `L${(w + open) / 2},${i} `
      + `L${(w - open) / 2},${i} z"></path>
  </svg>
  `);
  }

  const scene = story.scenes[0];
  scene
    // fills the background with stars at random positions
    .addAnimations([{
      selector: "#star-container",
      tasks: [
        {
          handler: 'factory',
          params: {
            count: 20,
            tag: 'img',
            attrs: [
              {
                name: 'src',
                value: 'https://www.abeamer.com/files/by-date/2018/08/abeamer-cover/assets/pixabay/star.png',
              },
              {
                name: 'style',
                value: "='left: ' + (frameWidth * random()) + 'px; top: ' + (frameHeight * random()) + 'px;'",
                isFormatted: true,
              },
            ],
          } as ABeamer.FactoryTaskParams,
        },
      ],
    }])
    // it moves the ufo from behing the scene to the center
    .addAnimations([{
      selector: "#ufo-container #ufo",
      duration: `${duration}s`,
      props: [{
        prop: 'margin-left',
        // uncomment the line bellow to try a diffent easing
        // easing: ABeamer.EasingName.easeOutExpo,    
        value: (w - imgSize) / 2,
      }],
    }])
    // it lowers the beam cone to lower part of the scene
    .addAnimations([{
      selector: "#svg-container",
      duration: `${duration}s`,
      props: [{
        prop: 'html',
        valueText: svgContent,
      }],
    }])
    // the moves the Beamer up while reducing the font-size of 'Beamer' and 'A'
    .addAnimations([{
      selector: "#Beamer",
      duration: `${duration}s`,
      props: [{
        prop: 'margin-bottom',
        valueStart: 0,
        value: h - topBound - 30,
        valueFormat: '%fpx',
      }, {
        prop: 'font-size',
        valueStart: 80,
        value: 20,
        valueFormat: '%f%',
      }],
    }, {
      selector: "#A",
      duration: `${2 * duration}s`,
      props: [{
        prop: 'font-size',
        valueStart: 100,
        value: 10,
        valueFormat: '%f%',
      }],
    }])
    // it executes the beam cone in reverse direction, by using valueStart=1 and value=0
    .addAnimations([{
      selector: "#svg-container",
      duration: `${duration}s`,
      props: [{
        prop: 'html',
        valueStart: 1,
        value: 0,
        valueText: svgContent,
      }],
    }])
     // it hides the text and the beam in 1 frame. 
     // it could be done in paralel with the next animation
    .addAnimations([{
      selector: "#text-container, #svg-container",
      duration: 1,
      props: [{
        prop: 'visible',
        valueStart: 1,
        value: 0,
      }],
    }])
    // it moves the ufo back to where it started
    .addAnimations([{
      selector: "#ufo-container #ufo",
      duration: `${duration}s`,
      props: [{
        prop: 'margin-left',
        value: - imgSize,
      }],
    },
    ])
    .addStills('0.5s');

  story.render(story.bestPlaySpeed());
});

            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console