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="lottie"></div>
              
            
!

CSS

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

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

  display: flex;
  justify-content: center;
  align-items: center;
}

#lottie {
  margin: auto;
  width: auto;
  height: 100vh;
}

              
            
!

JS

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

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

              
            
!
999px

Console