Giter Site home page Giter Site logo

lottie-api's Introduction

Lottie for Web, Android, iOS, React Native, and Windows

Lottie is a mobile library for Web, and iOS that parses Adobe After Effects animations exported as json with Bodymovin and renders them natively on mobile!

For the first time, designers can create and ship beautiful animations without an engineer painstakingly recreating it by hand. They say a picture is worth 1,000 words so here are 13,000:

View documentation, FAQ, help, examples, and more at airbnb.io/lottie

Example1

Example2

Example3

Community

Example4

Plugin installation

Option 1 (Recommended):

Download it from from aescripts + aeplugins: https://aescripts.com/bodymovin/

Option 2:

Or get it from the adobe store https://exchange.adobe.com/creativecloud.details.12557.html CC 2014 and up.

Other installation options:

Option 3:

  • download the ZIP from the repo.
  • Extract content and get the .zxp file from '/build/extension'
  • Use the ZXP installer from aescripts.com.

Option 4:

  • Close After Effects

  • Extract the zipped file on build/extension/bodymovin.zxp to the adobe CEP folder:
    WINDOWS:
    C:\Program Files (x86)\Common Files\Adobe\CEP\extensions or
    C:\<username>\AppData\Roaming\Adobe\CEP\extensions
    MAC:
    /Library/Application\ Support/Adobe/CEP/extensions/bodymovin
    (you can open the terminal and type:
    $ cp -R YOURUNZIPEDFOLDERPATH/extension /Library/Application\ Support/Adobe/CEP/extensions/bodymovin
    then type:
    $ ls /Library/Application\ Support/Adobe/CEP/extensions/bodymovin
    to make sure it was copied correctly type)

  • Edit the registry key:
    WINDOWS:
    open the registry key HKEY_CURRENT_USER/Software/Adobe/CSXS.6 and add a key named PlayerDebugMode, of type String, and value 1.
    MAC:
    open the file ~/Library/Preferences/com.adobe.CSXS.6.plist and add a row with key PlayerDebugMode, of type String, and value 1.

Option 5:

Install the zxp manually following the instructions here: https://helpx.adobe.com/x-productkb/global/installingextensionsandaddons.html Skip directly to "Install third-party extensions"

Option 6:

Install with Homebrew-adobe:

brew tap danielbayley/adobe
brew cask install lottie

After installing

  • Windows: Go to Edit > Preferences > Scripting & Expressions... > and check on "Allow Scripts to Write Files and Access Network"
  • Mac: Go to Adobe After Effects > Preferences > Scripting & Expressions... > and check on "Allow Scripts to Write Files and Access Network"

Old Versions

  • Windows: Go to Edit > Preferences > General > and check on "Allow Scripts to Write Files and Access Network"
  • Mac: Go to Adobe After Effects > Preferences > General > and check on "Allow Scripts to Write Files and Access Network"

HTML player installation

# with npm
npm install lottie-web

# with bower
bower install bodymovin

Or you can use the script file from here: https://cdnjs.com/libraries/bodymovin Or get it directly from the AE plugin clicking on Get Player

Demo

See a basic implementation here.

Examples

See examples on codepen.

How it works

Here's a video tutorial explaining how to export a basic animation and load it in an html page

After Effects

  • Open your AE project and select the bodymovin extension on Window > Extensions > bodymovin
  • A Panel will open with a Compositions tab listing all of your Project Compositions.
  • Select the composition you want to export.
  • Select a Destination Folder.
  • Click Render
  • look for the exported json file (if you had images or AI layers on your animation, there will be an images folder with the exported files)

HTML

  • get the lottie.js file from the build/player/ folder for the latest build
  • include the .js file on your html (remember to gzip it for production)
<script src="js/lottie.js" type="text/javascript"></script>

You can call lottie.loadAnimation() to start an animation. It takes an object as a unique param with:

  • animationData: an Object with the exported animation data. Note: If your animation contains repeaters and you plan to call loadAnimation multiple times with the same animation, please deep clone the object before passing it (see #1159 and #2151.)
  • path: the relative path to the animation object. (animationData and path are mutually exclusive)
  • loop: true / false / number
  • autoplay: true / false it will start playing as soon as it is ready
  • name: animation name for future reference
  • renderer: 'svg' / 'canvas' / 'html' to set the renderer
  • container: the dom element on which to render the animation

It returns the animation instance you can control with play, pause, setSpeed, etc.

lottie.loadAnimation({
  container: element, // the dom element that will contain the animation
  renderer: 'svg',
  loop: true,
  autoplay: true,
  path: 'data.json' // the path to the animation json
});

Composition Settings:

Check this wiki page for an explanation for each setting. https://github.com/airbnb/lottie-web/wiki/Composition-Settings

Usage

Animation instances have these main methods:

play


stop


pause


setSpeed(speed)

  • speed: 1 is normal speed.

goToAndStop(value, isFrame)

  • value: numeric value.
  • isFrame: defines if first argument is a time based value or a frame based (default false).

goToAndPlay(value, isFrame)

  • value: numeric value.
  • isFrame: defines if first argument is a time based value or a frame based (default false).

setDirection(direction)

  • direction: 1 is forward, -1 is reverse.

playSegments(segments, forceFlag)

  • segments: array. Can contain 2 numeric values that will be used as first and last frame of the animation. Or can contain a sequence of arrays each with 2 numeric values.
  • forceFlag: boolean. If set to false, it will wait until the current segment is complete. If true, it will update values immediately.

setSubframe(useSubFrames)

  • useSubFrames: If false, it will respect the original AE fps. If true, it will update on every requestAnimationFrame with intermediate values. Default is true.

destroy()


getDuration(inFrames)

  • inFrames: If true, returns duration in frames, if false, in seconds.

Additional methods:

  • updateDocumentData -- updates a text layer's data More Info

Lottie has several global methods that will affect all animations:

lottie.play() -- with 1 optional parameter name to target a specific animation
lottie.stop() -- with 1 optional parameter name to target a specific animation
lottie.goToAndStop(value, isFrame, name) -- Moves an animation with the specified name playback to the defined time. If name is omitted, moves all animation instances.
lottie.setSpeed() -- first argument speed (1 is normal speed) -- with 1 optional parameter name to target a specific animation
lottie.setDirection() -- first argument direction (1 is normal direction.) -- with 1 optional parameter name to target a specific animation
lottie.searchAnimations() -- looks for elements with class "lottie" or "bodymovin"
lottie.loadAnimation() -- Explained above. returns an animation instance to control individually.
lottie.destroy(name) -- Destroys an animation with the specified name. If name is omitted, destroys all animation instances. The DOM element will be emptied.
lottie.registerAnimation() -- you can register an element directly with registerAnimation. It must have the "data-animation-path" attribute pointing at the data.json url
lottie.getRegisteredAnimations() -- returns all animations instances
lottie.setQuality() -- default 'high', set 'high','medium','low', or a number > 1 to improve player performance. In some animations as low as 2 won't show any difference.
lottie.setLocationHref() -- Sets the relative location from where svg elements with ids are referenced. It's useful when you experience mask issues in Safari.
lottie.freeze() -- Freezes all playing animations or animations that will be loaded
lottie.unfreeze() -- Unfreezes all animations
lottie.inBrowser() -- true if the library is being run in a browser
lottie.resize() -- Resizes all animation instances

Events

  • onComplete
  • onLoopComplete
  • onEnterFrame
  • onSegmentStart

you can also use addEventListener with the following events:

  • complete
  • loopComplete
  • drawnFrame
  • enterFrame
  • segmentStart
  • config_ready (when initial config is done)
  • data_ready (when all parts of the animation have been loaded)
  • data_failed (when part of the animation can not be loaded)
  • loaded_images (when all image loads have either succeeded or errored)
  • DOMLoaded (when elements have been added to the DOM)
  • destroy

Other loading options

  • if you want to use an existing canvas to draw, you can pass an extra object: 'rendererSettings' with the following configuration:
lottie.loadAnimation({
  container: element, // the dom element
  renderer: 'svg',
  loop: true,
  autoplay: true,
  animationData: animationData, // the animation data
  // ...or if your animation contains repeaters:
  // animationData: cloneDeep(animationData), // e.g. lodash.clonedeep
  rendererSettings: {
    context: canvasContext, // the canvas context, only support "2d" context
    preserveAspectRatio: 'xMinYMin slice', // Supports the same options as the svg element's preserveAspectRatio property
    title: 'Accessible Title', // Adds SVG title element for accessible animation title
    description: 'Accessible description.', // Adds SVG desc element for accessible long description of animation
    clearCanvas: false,
    progressiveLoad: false, // Boolean, only svg renderer, loads dom elements when needed. Might speed up initialization for large number of elements.
    hideOnTransparent: true, //Boolean, only svg renderer, hides elements when opacity reaches 0 (defaults to true)
    className: 'some-css-class-name',
    id: 'some-id',
  }
});

Doing this you will have to handle the canvas clearing after each frame
Another way to load animations is adding specific attributes to a dom element. You have to include a div and set it's class to "lottie". If you do it before page load, it will automatically search for all tags with the class "lottie". Or you can call lottie.searchAnimations() after page load and it will search all elements with the class "lottie".

  • Add the data.json to a folder relative to the html
  • Create a div that will contain the animation.
  • Required
    • A class called "lottie"
    • A "data-animation-path" attribute with relative path to the data.json
  • Optional
    • A "data-anim-loop" attribute
    • A "data-name" attribute to specify a name to target play controls specifically

Example

 <div style="width:1067px;height:600px"  class="lottie" data-animation-path="animation/" data-anim-loop="true" data-name="ninja"></div>

Preview

You can preview or take an svg snapshot of the animation to use as poster. After you render your animation, you can take a snapshot of any frame in the animation and save it to your disk. I recommend to pass the svg through an svg optimizer like https://jakearchibald.github.io/svgomg/ and play around with their settings.

Recommendations

Files

If you have any images or AI layers that you haven't converted to shapes (I recommend that you convert them, so they get exported as vectors, right click each layer and do: "Create shapes from Vector Layers"), they will be saved to an images folder relative to the destination json folder. Beware not to overwrite an existing folder on that same location.

Performance

This is real time rendering. Although it is pretty optimized, it always helps if you keep your AE project to what is necessary
More optimizations are on their way, but try not to use huge shapes in AE only to mask a small part of it.
Too many nodes will also affect performance.

Help

If you have any animations that don't work or want me to export them, don't hesitate to write.
I'm really interested in seeing what kind of problems the plugin has.
my email is [email protected]

AE Feature Support

  • The script supports precomps, shapes, solids, images, null objects, texts
  • It supports masks and inverted masks. Maybe other modes will come but it has a huge performance hit.
  • It supports time remapping
  • The script supports shapes, rectangles, ellipses and stars.
  • Expressions. Check the wiki page for more info.
  • Not supported: image sequences, videos and audio are not supported
  • No negative layer stretching! No idea why, but stretching a layer messes with all the data.

Development

npm install or bower install first npm start

Notes

  • If you want to modify the parser or the player, there are some gulp commands that can simplify the task
  • look at the great animations exported on codepen See examples on codepen.
  • gzipping the animation jsons and the player have a huge reduction on the filesize. I recommend doing it if you use it for a project.

Issues

  • For missing mask in Safari browser, please call lottie.setLocationHref(locationHref) before animation is generated. It usually caused by usage of base tag in html. (see above for description of setLocationHref)

Contributors

Code Contributors

This project exists thanks to all the people who contribute. [Contribute].

Financial Contributors

Become a financial contributor and help us sustain our community. [Contribute]

Individuals

Organizations

Support this project with your organization. Your logo will show up here with a link to your website. [Contribute]

lottie-api's People

Contributors

bodymovin avatar dan-shields avatar dependabot[bot] avatar nightink avatar phillbaker avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lottie-api's Issues

How to change position of layers?

Hello, Ive been trying to change the position of a layer in a lottie animation. I can't seem to get it to work and was wondering if anyone had an example of this working? Thanks so much.

Accessing layers

Is there any way to simply access a layer/path of a Lottie animation in JS like you would in CSS?

When the image is included in the animation, calling the API will report an error.

When the image is included in the animation, calling the API will report an error.

src\layer\LayerBase.js:8 Uncaught TypeError: Cannot read property 'finalTransform' of undefined at LayerBase (src\layer\LayerBase.js:8) at Image (src\layer\image\ImageElement.js:9) at getLayerApi (src\helpers\layerAPIBuilder.js:19) at src\animation\AnimationItem.js:8 at Array.map (<anonymous>) at AnimationItemFactory (src\animation\AnimationItem.js:8) at Object.createAnimationApi (src\index.js:4) at tupian (demo.html:57) at HTMLButtonElement.onclick (demo.html:36)

In the API image function, LayerBase(element) is used, but there is a function call state.element.finalTransform in LayerBase, but the dictionary data passed in here will not find finalTransform.

Fix suggestion:
from
`function Image(element) {

var methods = {};

return Object.assign({}, LayerBase(element), methods);

}tofunction Image(element, parent) {

var methods = {};
var state = {
    element: element,
    parent: parent,
    properties: []
};

return Object.assign({}, LayerBase(state), methods);

}`

Animation not following instruction in local svelte build

Hej,

I am trying to integrate lottie-web and lottie-api in a Svelte application.
I took the following codepen example:
https://codepen.io/driezis/pen/zYOQLrw

and made a svelte version from it:
https://codesandbox.io/s/followingfacesvelte-3grho

It works nicely in the codesandbox, but when I download the zip with all the files from the codesandbox and try to have it build locally, the face is not following the mouse.

It may has something to do with this issue: airbnb/lottie-web#2599

I am out of my depth by now, any suggestions on how to solve this?

Best,
Rasmus

Smooth transition within a value callback

Hello,

I'd like to use a Lottie animation for a progress bar, ideally in such a way that I can connect all elements to a single slider control, then change the value callback of this slider with JS from 0 - 100. This isn't hard to do at all, but one issue I notice is that I don't know how to gradually change the value -- I only know how to change it from numbers like 0 to 20 in two frames, instead of simulating something like a cubic-bezier timing so that it ramps from one number to the next.

Is there any easy way to achieve this?

Animate values

The api is and works great for editing values of an animation, so thank you for this!

But is it possible to animate a value change? For example, changing the Transform - Position property at random so the object goes from A to B in a smooth motion, instead of jumping to it's new position.

I can get the position to change, but the object isn't moving towards the new object. I guess because it doesn't know it's new position? Is this possible with the api or should I be looking at different solution, if possible at all?

Thank you in advance!

EDIT:
And adding to this, is it possible to use the lottie-api in combination with playSegments (looping and not looping). Since I got it to work, but it stops after playing the segment. I used the example where an object follows the mouse.

Not working with Lottie-Web v5.1.13

I am trying to use this library to modify some lottie animations but have run into some problems where the api cannot find the data on the layers.

When I call animationAPI.getLayersByName('text-layer') I get Cannot read property 'nm' of undefined. It seems as if maybe Lottie-web changed its animation model or maybe Im not loading things properly?

Upon further inspection of LayerList.js:18, none of the elements in the loop have a data property which is causing it to throw an error.

Here is my code

import SVG from 'svg.js';
import Lottie from 'lottie-web';
import LottieAPI from 'lottie-api';

export default class SVGEngine {
  constructor() {
    // this.height = height;
    // this.width = width;
  }

  start(id) {
    if (!SVG.supported) {
      // SVG NOT SUPPORTED
      console.log('svg not supported');
      return;
    }


    const element = document.getElementById(id);
    var animationAPI;
    var animData = {
      container: element, // the dom element that will contain the animation
      renderer: 'svg',
      loop: false,
      autoplay: true,
      path: '../static/assets/test/animation-test-01.json' // the path to the animation json
    };
    const anim = Lottie.loadAnimation(animData);

    anim.addEventListener("DOMLoaded", function(){
      animationAPI = LottieAPI.createAnimationApi(anim);

      console.log('anim api', animationAPI.getLayersByName('text-layer'));
    });



    console.log('anim',anim);
    
  }
}```

Typescript Definitions

Now that lottie-web has official typescript definitions, maybe we can get them created for lottie-api as well?

How to use other methods, is there a manual?

Such as these methods:
getKeyPath,
addValueCallback,
recalculateSize,
toContainerPoint,
fromContainerPoint...

I see these methods, but I can't figure out how to call them. Are there any examples to help me figure out how to use them?

addValueCallback() doesn't work unless animData.loop = true

I've always wanted to create dynamic backgrounds, like this:

But wanted to harness Lottie API to have the eyes actually follow the user's cursor, which works very smoothly for only one instance but has a noticeable lag/performance hit with multiple:

I understand what I'm doing here is very taxing, but can it be confirmed whether addValueCallback() only works when animData.loop is true? This seems like odd/undesirable behavior in the instance I'd want to have an initial state (like the eye opening) then dynamically pass a new value in later, because atm it only works when the eyes are constantly flashing open and closed (since it's looping the entirety of the animation) unless I use a completely separate file which doesn't have those keyframes.

[bug]Can't directly modify colors in animation

function setValue(value) { var property = state.property; if (!property || !property.addEffect) { return; } if (typeof value === 'function') { return property.addEffect(value); } else if (property.propType === 'multidimensional' && (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' && **value.length === 2**) { return property.addEffect(function () { return value; }); } else if (property.propType === 'unidimensional' && typeof value === 'number') { return property.addEffect(function () { return value; }); } }

When i do not appily the AddValueCallback method to modify the color data and modify the color data directly through setvalue(),I cannot modify it successfully. Because the format of color data is [r, g, b, a]. The length of this array is 4, so in this case the conditions in if cannot be met, so the color data cannot be modified.

t

fixed**

Fails to find Keypath

Hi @bodymovin ,
we are trying to add a valueCallback to our animation to change color of a gradient fill.

This is our animation :
animation

What we tried:

var property = animationAPI.getKeyPath("COCKTAIL_STANDARD,Group 1,Gradient Fill 1")
animationAPI.addValueCallback(property, function(currentValue) {
        console.log("Current Value -", currentValue)
        return [0.1, 0.2, 0.3, 1]
    })

We noticed that the callback is never called, investigating the functiong getKeypath it seems that it can't find the childs of the first Keypath.

Can you please help us?
Thanks

Opacity not working

I'm trying to target Opacity and it won't work. Neither does with Shape Layers and Null Objects.

Can you try targeting the Opacity and confirm it is not working?

Change color dynamically in lottie json

Hi all,
I did Lottie animation by using Lottie-web` and now trying to change the color dynamically so I used Lottie API(https://github.com/bodymovin/lottie-api). In that, I got the keyPath for changing the color but don't know how to change the color of an object.

var animData = {
      container: animationContainer,
      renderer: "canvas",
      loop: true,
      autoplay: true,
      rendererSettings: {
        preserveAspectRatio: "xMidYMid meet"
      },
      path: "https://labs.nearpod.com/bodymovin/demo/chameleon/chameleon2.json"
    };
    anim = lottie.loadAnimation(animData);

for changing the color of a Lottie JSON I used

animationAPI.getKeyPath(
        "#leaf_3,Contents,color_group,fill_prop,Color"
      );

I got the path of an object but now I don't know how to change the color so Kindly help me if anyone knows?

@bodymovin @lottie-api @lottie-web

addValueCallback to a 'slider value' on a NullObject.

Hi there,

Just discovered the web-API and it works fine on all the transformation properties of a layer.
But i can't seem to get it to work with Slider Effects on a NullObject.
What im trying to achieve is a dynamic animation, where a slider value controls the length of a bar-graph and text representing the value.
All the animations are done (and linked to the slider) in AE, and all i need to change is the value of the slider to control the animation. But is can't seem to get it to work on any other property outside transform.

I found documentation about dynamic properties on Android: https://airbnb.io/lottie/android/dynamic.html
And assuming its the same for web, it doesn't say other variables are supported. (in my case the null object containing a slider control)

Are there any plans on upgrading the API so more properties are supported?
Or am i missing something and can i achieve my goal in any other way with the API that i don't know of.

I've been trying the old way of directly changing the value without the API, but i can't seem to get that working anymore :(
anim.animationData.layers[0].ef[0].ef[0].v.k[0].s[0]

Are there any great minds out there who can push me in the right direction?
Thanks in advance!

Documentation lacking and/or unclear

Hello @bodymovin,

I'm finding it pretty hard to understand the methods (specifically parameters within them) of this repo beyond the example located in /examples and the codepen you've linked to of the Duik walk cycle. Can a more detailed write up of the readme or a few more examples be added to a queue on your workload?

In this instance:

var neckAndHead_softness_key_path = animAPI.getKeyPath(
    "C | Walk Cycle,Effects,Walk Cycle,35"
  );
  animAPI.addValueCallback(neckAndHead_softness_key_path, function(current) {
    return controls.neckAndHead_softness;
  });

Since I don't have access to your AEP, I don't really know if C | Walk Cycle is the name of a layer, or C (pipe) is a special syntax referring to a layer named Walk Cycle, etc. I don't know how to access a layer within a precomp (how do I use getKeyPath for a layer not at first depth?) and I don't know how to make a single change to a single property then destroy/disable it's reference/valueCallback. From what I see in the docs, I'd be adding a new valueCallback each time I want to change this -- in my use case, valueCallbacks can't be hardcoded like the above.

I'd love to use this library extensively and begin to help out with documentation and pull requests, but it's been a struggle to understand without a bit more initial information.

Thanks for all the great work

Multiple dependency vulnerabilities in npm module

Hello Hernan,

The lottie-api npm package @1.0.0 reports 6 vulnerabilities on install:

npm WARN deprecated [email protected]: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
npm WARN deprecated [email protected]: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
npm WARN deprecated [email protected]: This module relies on Node.js's internals and will break at some point. Do not use it, and update to [email protected].
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

+ [email protected]
added 145 packages from 122 contributors and audited 19537 packages in 14.033s
found 6 vulnerabilities (1 low, 1 moderate, 4 high)

With npm audit:

  High            Regular Expression Denial of Service                          
                                                                                
  Package         minimatch                                                     
                                                                                
  Patched in      >=3.0.2                                                       
                                                                                
  Dependency of   lottie-api                                                    
                                                                                
  Path            lottie-api > gulp > vinyl-fs > glob-stream > glob >           
                  minimatch                                                     
                                                                                
  More info       https://nodesecurity.io/advisories/118                        
                                                                                
                                                                                
  High            Regular Expression Denial of Service                          
                                                                                
  Package         minimatch                                                     
                                                                                
  Patched in      >=3.0.2                                                       
                                                                                
  Dependency of   lottie-api                                                    
                                                                                
  Path            lottie-api > gulp > vinyl-fs > glob-stream > minimatch        
                                                                                
  More info       https://nodesecurity.io/advisories/118                        
                                                                                
                                                                                
  High            Regular Expression Denial of Service                          
                                                                                
  Package         minimatch                                                     
                                                                                
  Patched in      >=3.0.2                                                       
                                                                                
  Dependency of   lottie-api                                                    
                                                                                
  Path            lottie-api > gulp > vinyl-fs > glob-watcher > gaze > globule  
                  > glob > minimatch                                            
                                                                                
  More info       https://nodesecurity.io/advisories/118                        
                                                                                
                                                                                
  High            Regular Expression Denial of Service                          
                                                                                
  Package         minimatch                                                     
                                                                                
  Patched in      >=3.0.2                                                       
                                                                                
  Dependency of   lottie-api                                                    
                                                                                
  Path            lottie-api > gulp > vinyl-fs > glob-watcher > gaze > globule  
                  > minimatch                                                   
                                                                                
  More info       https://nodesecurity.io/advisories/118                        
                                                                                
                                                                                
  Moderate        Prototype Pollution                                           
                                                                                
  Package         lodash                                                        
                                                                                
  Patched in      >=4.17.11                                                     
                                                                                
  Dependency of   lottie-api                                                    
                                                                                
  Path            lottie-api > gulp > vinyl-fs > glob-watcher > gaze > globule  
                  > lodash                                                      
                                                                                
  More info       https://nodesecurity.io/advisories/782                        
                                                                                
                                                                                
  Low             Prototype Pollution                                           
                                                                                
  Package         lodash                                                        
                                                                                
  Patched in      >=4.17.5                                                      
                                                                                
  Dependency of   lottie-api                                                    
                                                                                
  Path            lottie-api > gulp > vinyl-fs > glob-watcher > gaze > globule  
                  > lodash                                                      
                                                                                
  More info       https://nodesecurity.io/advisories/577                        
                                                                                
found 6 vulnerabilities (1 low, 1 moderate, 4 high) in 19537 scanned packages

I'd love to use the node module instead of adding the file client side but was discouraged from using it the last few weeks due to these and not knowing if manual review would introduce breaking changes. Will attempt to manually fix the dependencies and report here

Change the player container

@bodymovin
Hi,
At first let me thank you for this terrific and amazing plugin! :)
I want to use it as a hover effect in my new project.
there are many DIVs in my html and I want my animation plays in each div when mouse goes over it. actually I need to change the container of my player.
I tried to change the container parameter in a javascript function that I called in onMouseOver() event but it didn't work.
is there any way solve this problem?

Declaration types

Please update declaration types in package release. At the moment is not possible to easly use this lib with TypeScript.

How to retrieve the value of a property?

I'm having no trouble using getKeyPath() and addValueCallback() but I cannot figure out how to simply retrieve the value of a property, eg as an array. How can I determine the Position property of a layer as an array of [x,y,z] values? Better still, where is the documentation that explains how to do this! I've been googling for over an hour for something that seemingly ought to be so simple.

KeyPathList function has logic bugs on iteration

无标题a
无标题2
无标题33

The animation project I am currently working on has a text-blinking effect. To achieve it I copied the text layer and kept them with the same name. Then I tried to update the text in this animation through the API. But it can only change 1 content. I tried the debug problem and I found that the getkeypath of the API seems to have an iterative logic problem. In the structure of the entire animation json file, the type of the layer is comp-comp-comp-[text layer, text layer]. But the log result of the api node_type is renderer-layer-property-property. I tried to get the node_type with the actual project, but the structure I found was always renderer-layer-property......property. This is the first point I think is problematic.This is my update code.

 var mark_='superrocket,p1,p2,33';
    var result="12331133";
    function aaa(){
        var animapi=lottie_api.createAnimationApi(anim);
        var animkp=animapi.getKeyPath(mark_);
        console.log(animkp.getElements());
        for (ae in animkp.getElements()){  
            animkp.getElements()[ae].setText(result,0);
        }    
    }

Continuing the study I found that the _filterLayerByName function had a problem with the node not being found during the second iteration. The problem is that the elements remain unchanged after the second iteration, and are always a content, which causes element.getTargetLayer().data.nm to always be a superrocket, rather than the correct iteration of the child. So both nodeByname and nodeByType are 0, and then all node_types are property after the third iteration. So it can only get one goal instead of all.

But since getkeypath is the core interface of the entire API, its iterative logic includes more complex effects on other functions. So in a short time, I have not found a solution to fix this bug.
ae file.zip

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.