www.webdeveloper.com
Results 1 to 2 of 2

Thread: tween from current position

  1. #1
    Join Date
    Sep 2010
    Posts
    10

    tween from current position

    Hey dev'rs

    I would like to be able to tween an image dynamically from it's current position on a mouse over event. A good example of what I want can be found here. (the nav cloud)

    I haven't been able to find anything on jquery or anywhere else, so here's what I've come up with so far:

    Code:
    // this is the code to find the current y position (slightly altered from here) 
    
    function findPosition( oElement ) {
      if( typeof( oElement.offsetParent ) != 'undefined' ) {
        for( var posX = 0, posY = 0; oElement; oElement = oElement.offsetParent ) {
          posX += oElement.offsetLeft;
          posY += oElement.offsetTop;
        }
        return [ posY ];
      } else {
        return [ oElement.y ];
      }
    }
    
    // this function is called from the mouse over event with the 'findPosition' function in the 'tween from' area. (tween from jstween)
    
    function moveCurlybrace()
    {
      cbTween = new Tween(document.getElementById('galleryCurlybrace').style,'top',Tween.regularEaseOut,findPosition('galleryCurlybrace'),300,.5,'px');
      cbTween.start();
    }
    I spent all day trying variations of this model, but nothing has worked so far. I've also looked everywhere for a similar solution. Am I even on the right track here?

    Any help/feedback appreciated.
    Thanks

  2. #2
    Join Date
    Sep 2010
    Posts
    10
    You can see it in all it's crappy-nes here.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles