Pen Settings

HTML

CSS

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

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

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.

HTML

              
                <div id="lottie"></div>
              
            
!

CSS

              
                @import url("https://fonts.googleapis.com/css2?family=Exo:wght@600&display=swap");

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  line-height: 1.5;
  font-size: 15px;
  font-weight: 400;
}

body {
  width: 100vw;
  min-height: 100vh;

  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;

  font-family: "Exo", Arial, sans-serif;
  background-color: #151522;
  color: #fff;
}

#lottie {
  margin-left: auto;
}

              
            
!

JS

              
                import bodymovin from "https://cdn.skypack.dev/lottie-web";

var animation = bodymovin.loadAnimation({
  // 动效加载到的DOM元素
  container: document.getElementById("lottie"), // 必须项
  // 包含动效的JSON文件的相对路径,也可以是绝对路径
  path:
    "https://www.w3cplus.com/sites/default/files/blogs/2021/2101/lottie-web.json",
  // 必须项,描述动效的JSON文件,一般由AE软件中导出的JSON文件
  // 动效渲染出来的格式,可以是svg、canvas和html
  renderer: "svg",
  // 必须项,除了svg选择之外还可以是canvas和html
  // 用于指定动效是否循环播放,true是循环播放,false不是循环播放
  loop: true, // 可选项
  // 指定动效是不是加载后就立即播放,true是立即播放,false不是立即播放
  autoplay: true, // 可选项
  // 指定动效的名称
  name: "mic animation" // 可选项
  // animationData与path互斥,是一个包含导出的动画数据的对象 // animationData: { // ... }
});

              
            
!
999px

Console