ericdrowell / KineticJS

KineticJS is an HTML5 Canvas JavaScript framework that extends the 2d context by enabling canvas interactivity for desktop and mobile applications.
http://www.kineticjs.com
3.98k stars 753 forks source link

How can I tween shape gradient fill stops? #901

Closed AxoInsanit closed 10 years ago

AxoInsanit commented 10 years ago

Is there way to do this with the current Tween object?

lavrton commented 10 years ago

Do you meen color or point position?

AxoInsanit commented 10 years ago

Color

jfollas commented 10 years ago

You can use an external tweening library, like GreenSock (http://www.greensock.com/gsap-js/) with it's ColorProps plugin (http://api.greensock.com/js/com/greensock/plugins/ColorPropsPlugin.html) to tween colors and then apply them to the Kinetic shape on each frame update:

http://jsfiddle.net/ZH2AS/2/

AxoInsanit commented 10 years ago

Thanks for the reply, my question was "is there way to do this with the current Tween object?" So I guess that's a no? Are there plans to add support for this on Tween? the whole idea of using something like KineticJS is not having to resort to other libraries...

jfollas commented 10 years ago

No plans for direct support of tweening color stops on a gradient fill.

I would consider this tween to be an outlier that would justify the use of an external library, since it's easy enough to implement with something like Greensock, and deferring complex/outlier tweens to an external engine does not inflate the Kinetic library's size (and potential slow down built-in tween animations in the process for everyone else who just need simple tweens). Once you have justification for using Greensock for a complex tween, then you can actually use it for all of your tweens.

Sent from my Windows Phone

-----Original Message----- From: "AxoInsanit" notifications@github.com Sent: ‎4/‎20/‎2014 3:48 PM To: "ericdrowell/KineticJS" KineticJS@noreply.github.com Cc: "jfollas" jfollas@gmail.com Subject: Re: [KineticJS] How can I tween shape gradient fill stops? (#901)

Thanks for the reply, my question was "s there way to do this with the current Tween object?" So I guess that's a no? Are there plans to add support for this on Tween? the whole idea of using something like KineticJS is not having to resort to other libraries... — Reply to this email directly or view it on GitHub.