Jump to content
Search Community

KokoDoko

Members
  • Posts

    6
  • Joined

  • Last visited

Posts posted by KokoDoko

  1. There's a tool in the works that'll make this slightly more "formalized", but we're not ready to release that quite yet. "Shockingly Green" and "Business Green" Club GreenSock members can request a preview of it, but I can't promise a specific launch date. It has some other fancy tricks it can do too, of course (related to transforms). :)

     

    Any idea on a release date? I am currently using typescript with greensock, and this unformal way is resulting in some ugly workarounds. If _gsTransform already exists, why not simply make it accessible with TweenLite.get(x) ?

  2. I am trying to figure out how to do collision detection with greensock and the CSS plugin.

    My CSS elements all have "position: absolute" and they are moved across the screen setting their x and y positions with TweenLite.

     

    Normally you could use the DOM elements' position to calculate if their boundaries intersect, but how can you do this with css transforms?

     

    Thanks!

  3. Sorry there was a mistake in the code above (not in the codepen) that i just fixed

     

    gsTransform should be _gsTransform.

     

     

     

    To get the value of the DOM element on mouse down, you can do this:

     

     target.on("mousedown", function() {
        tween.kill();
        console.log("element x = " + this._gsTransform.x)
      });

     

    See the Pen LoDCv by GreenSock (@GreenSock) on CodePen

     

    Just wondering: why is this not in the documentation, and why is there no official "get()" method? It seems a bit hacky, and modern editors will show an error when you try to access _gsTransform on a htmlelement. 

     

    Will better support for "get()" be added in the future?

  4. I am looking for a way to know the current position of a x,y tween. I am using the css plugin to move DOM elements around the screen. I'm not sure if I am overlooking something. I have searched the forums and documentation, and all I could find was the tip to hack a secretly hidden property of a tweened element:

     

    _gsTransform

     

    My question: is there no official way to get the x and y properties? Is this secret hack the only way? It seems a bit hacky to me, and it doesn't result in clean code.

     

    TweenLite.get() would be great!

     

    btw, this problem gets worse when you use typescript, since the typescript definition file does not include _gsTransform.

    In typescript, you will get this error when you try to read _gsTransform:

     

    let x = this.element._gsTransform.x

    // error: htmlElement has no property _gsTransform

     

    Of course, I can add _gsTransform manually, but that's even more hacky.

×
×
  • Create New...