Jump to content


  • Posts

  • Joined

  • Last visited

Recent Profile Visitors

2,254 profile views

gosu's Achievements

  1. That's really nice feature I was going to do it myself.. perfect timing
  2. Okay it turns out the extern file provided is almost doable. I needed to add some support for Draggable, may help someone: var TweenMax = {}; var Draggable = {}; Draggable.create = function () {}; Draggable.prototype.hitTest = function () {}; Draggable.prototype.applyBounds = function () {}; Draggable.prototype.onDragStart = function () {}; Draggable.prototype.onComplete = function () {}; Draggable.prototype.onStart = function () {}; Draggable.prototype.onDrag = function () {}; Draggable.prototype.onPress = function () {}; Draggable.prototype.onRelease = function () {}; Draggable.prototype.onDragEnd = function () {}; TweenMax.prototype.lagSmoothing = function () {};
  3. Are there any new GSAP extern files, I guess this is quite outdated?
  4. This issue may not be related to greensock directly (more of a jQuery issue).
  5. Try this: var $elements = $('div'); $elements.on("mouseover", function() { TweenMax.to($elements.not($(this)), .3, {opacity:0}); }).on("mouseout", function() { TweenMax.to($elements, .3, {opacity:1}); });
  6. Hey, I am using Draggable with hitTest() to determine possible drop spots. I needed more advanced solution to get the drop spots ordered by percent covered (if draggable object is dropped on 2 or more droppable spots - I needed the one which has the most overlap area covered). Otherwise you end up with let's say 1 draggable element being dropped on 2 possible droppable elements (both having the minimum threshold), it won't matter if you cover one of the elements waaaay more than the other. For this I modified Draggable.js if (isRatio) { threshold *= 0.01; area = overlap.width * overlap.height; // edit here return [(area >= r1.width * r1.height * threshold || area >= r2.width * r2.height * threshold), area]; } return (overlap.width > threshold && overlap.height > threshold); and onDragEnd: lastOverlapScore = 0; var highestScoreObject = null; $.each(droppables, function (i, obj) { var overlap = draggable.hitTest(obj, '25%'); // some threshold if (Array.isArray(overlap) && overlap[0] === true && lastOverlapScore < overlap[1]) { lastOverlapScore = overlap[1]; var highestScoreObject = obj; } }); // highestScoreObject is the element with highest coverage area This may help someone looking for similar result or may be in use if you decide to add way to get the score. It would be less hacky solution of I could get the area from Draggable without having to modify it, but though I'm happy it works.
  7. I think he's trying to say that when you try to drag the green square by holding it at the very right bottom edge, and you go outside red bordered rectangle (#placeholder) and the square gets resized, the position of the cursor stays very far from the center of the dragged square.
  8. I don't see any greensock api used in your example?
  9. I don't think your selector is good. Try with var mydiv = $('img'[data-name=test]');
  10. gosu

    Draggable groups

    Thanks! I didn't realize this simple solution could work so good. Same solution with jQuery UI shows alot of lag when dragging - http://jsfiddle.net/Mottie/EhP2N/
  11. gosu

    Draggable groups

    Is there any chance to see grouping of Draggable elements so that when you drag single element of a group, all elements of the group are being dragged. There's such functionality in YUI: http://yuilibrary.com/yui/docs/api/classes/DD.Drop.html#method_addToGroup http://yuilibrary.com/yui/docs/api/classes/DD.Drop.html#method_removeFromGroup Something like: var draggable1 = Draggable.create(element1); draggable1.addToGroup('group'); var draggable2 = Draggable.create(element2); draggable2.addToGroup('group');