2017-08-14 66 views

回答

1

典型的进口

import {TweenMax, Power2, TimelineLite} from "gsap"; 

获取不包含内部TweenMax

import Draggable from "gsap/Draggable"; 
import ScrollToPlugin from "gsap/ScrollToPlugin"; 

对于部分详细信息

https://www.npmjs.com/package/gsap#npm

+0

谢谢,这个问题是不工作的分型。 –

1

你不需要对它的类型。

  1. 将要在assets/javascripts
  2. 使用GSAP库包括你的文件在您src/index.html文件是这样的:我已经在几个项目(所有的打字稿)用它

    <script src="assets/javascripts/TweenMax.min.js"></script>

  3. 您的权利后进口,声明这样的GSAP对象(在你将要使用他们所有的意见):

    /* 
        Normal imports here.. 
    */ 
    import { LoginPage } from "../login/login"; 
    
    declare var TimelineMax: any;   
    declare var TweenMax: any; 
    declare var Power1: any; 
    
    @Component({ 
        selector: 'page-profile', 
        templateUrl: 'profile.html', 
        providers: [Data, Api, DatePipe] 
    }) 
    
    export class ProfilePage { 
        ... 
    
  4. 使用像正常:

    ... 
    ionViewDidLoad(){ 
        TweenMax.from(".logo", .5, { 
        opacity: 0, 
        y: -72, 
        ease: Power1.easeOut 
        }); 
    } 
    ...