Jump to content
Search Community

mogwai

Members
  • Posts

    1
  • Joined

  • Last visited

Posts posted by mogwai

  1. I'm working on a project using ReactJS with Pixi & GSAP and the js library I'm using is called "react-pixi-fiber".

    I'm trying to reference the React Pixi Sprite object and handling the animation it using GSAP. 

    However, it changes position without easing, and there's no error message showing.

     

    Code as below

     

    The "moveEle" function will be called from the parent component.

     

     
    class MainObject extends Component {
    constructor(props) {
    super(props);
    this.state = {
       ...
    };
    this._refEle = React.createRef();
    
    moveEle = options => {
    
    TweenLite.to(this._refEle, options.duration, {
    x: options.x,
    y: options.y,
    ease:Power2.easeOut
    
    }).play();
    };
    
    render() {
    
    return (
    <Fragment key="MainElesFragment">
    <Sprite
    ref={div => (this._refEle = div)}
    anchor={centerAnchor}
    texture={textureUrl}
    width={width}
    height={height}
    x={x}
    y={y}
    key="thisEle"
    />
    </Fragment>
    )
    
    }
    }
     
     
     
×
×
  • Create New...