Import anime library


#1

Hi,

I’m trying to import animejs library (https://github.com/juliangarnier/anime/) to my app. I have already put <script src="build/anime.min.js"></script> in my www/index.html, but now I don’t know how to import it to my ts file (for example: home.ts)
I have tried import { anime } from 'anime.min.js'; but no luck. Please help!


#2

Are you using Ionic 2.x or higher? AnimeJS is a JavaScript library, you will need to find a TypeScript library for this.


#3

I’ve tried to install animejs using npm and it’s working now. However, I’m still wondering how we can import library directly by js file.


#4

Because you need the ng2 version of Animejs (if any).

Anyway, try this code:

import * as anime from 'animejs';