Jump to content
Search Community

TR-i

Premium
  • Posts

    6
  • Joined

  • Last visited

Posts posted by TR-i

  1. We're a little out of sync. Objects in my world are PIXI sprites and nothing is CSS, only Javascript.

     

    I'll get it figured out, just wanted to know if there was some caveat. In case it might be a factor, here's how I registered 'spin':

     

    	gsap.registerEffect({
    		name: "spin",
    		effect: (targets, config) => {return gsap.to(targets, {duration: config.duration, repeat: config.repeat, yoyo: config.yoyo, ease: config.ease, pixi:{rotation: config.rotation}});},
    		defaults: {duration: 2, repeat: -1, yoyo: false, ease: "none", rotation: 360}});

     

  2. It's not a web page per se- over 10,000 lines of code. 'Small demo' is not in the vocabulary.

     

    The list of targets (me.objects) changes between calls to me.refresh(). Same effect, different targets. Need to destroy everything and rebuild the tween because objects cannot be added after the tween is created.

     

    I try to detect if there is already a tween and kill it: 

    if(me.spin === Object(me.spin)){me.spin.kill(); me.spin = null;}

    Also tried:

    gsap.globalTimeline.kill();

    But the object(s) are still getting attached to new tweens while still retaining the old ones.

  3. I do everything with objects ('spin' is a registered effect):

     

    function newbehavior(b){
    	const me = {};
    .
    .
    	me.spin = null;
    	me.refresh = function(){
    		if(me.spin === Object(me.spin)){me.spin.kill(); me.spin = null;}
    .
    .
    		me.spin = gsap.effects.spin(me.objects);
    		}
    	me.refresh();
    	return(me);
    }

    A call to .refresh() should kill the old tween. Instead, the tweens pile up.

×
×
  • Create New...