File size: 932 Bytes
52ae39e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
async function newLottieAnimation(x, y, json) {
  const newlottie = new fabric.Lottie(json, {
    left: x,
    top: y,
    width: 500,
    height: 500,
    originX: 'center',
    originY: 'center',
    backgroundColor: 'rgba(255,255,255,0)',
    cursorWidth: 1,
    stroke: '#000',
    strokeUniform: true,
    paintFirst: 'stroke',
    strokeWidth: 0,
    cursorDuration: 1,
    cursorDelay: 250,
    duration: duration * 1000,
    assetType: 'sprite',
    id: 'Sprite' + layer_count,
    objectCaching: false,
    strokeDashArray: false,
    inGroup: false,
    shadow: {
      color: '#000',
      offsetX: 0,
      offsetY: 0,
      blur: 0,
      opacity: 0,
    },
  });
  canvas.add(newlottie);
  canvas.requestRenderAll();
  newlottie.duration = newlottie.getDuration() * 1000;
  newlottie.goToSeconds(0);
  canvas.renderAll();
  newLayer(newlottie);
  canvas.setActiveObject(newlottie);
  canvas.bringToFront(newlottie);
}