Jump to content
Search Community

GSAP for function-based getters/setters

jrgalim test
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Greetings!  I'm currently developing a Haxe project that utilizes GSAP, but I am running into a compatibility issue with Haxe getters & setters.  Unlike typical JS getters/setters, Haxe generates functions in the class with a prefix "get_" or "set_" and then changes variable assignments to function calls at compile time.  For example, if I have the following setup:

public var myVar(get, set):Int;
function get_myVar():String{
   return parent.somethingCool;
   }
function set_myVar(value:String):String{
   parent.somethingCool = value;
   return value;
   }
   

if I call myVar = "blah", it's compiled to set_myVar("blah").  Because of this, if I try to tween myVar, it doesn't work since myVar doesn't exist.  Is there some way to create a plugin or something so the tween checks the target to see if target["get_"+<propname>] exists, and use that instead?  Let me know if that doesn't make sense, I'll try to clarify more.

 

Thanks!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...