Jump to content
GreenSock

Bams

Blitmask/ThrowProps > Infinite scroll

Recommended Posts

Hi!

 

I'm testing Blitmask and ThrowProps with this demo : https://greensock.com/throwprops-as

 

I'd like to use infinite scrolling for a touch app, so I passed Blitmask's wrap property to 'true' and I removed ThrowProps min and max.

 

It works except I have a bug when scrolling before or after the original height (not sure I'm clear).

 

Sorry, even in french it's hard to explain, so in english.. ;-)

 

Let me explain :

 

- When I scroll on the original text (not looped by wrap mode) it works perfectly

 

 

- But let's say I scroll lower than the original part of the text, mouse up, than scroll again from there, at mousemove, it jumps randomly anywhere else..

 

Here's my FLA : https://www.dropbox.com/s/x16i5olppd5qeva/BlitmaskTest.fla?dl=0

 

 

 

 

 

 

 

Link to comment
Share on other sites

there is code in the mousemove handler that adjusts for the content to overscroll slightly when you reach the bounds. this code will not work well when you want an infinite wrapping scroll. please try updating the mouseMoveHandler() function with the following

 

function mouseMoveHandler(event:MouseEvent):void {
var y:Number = this.mouseY - yOffset;
//if mc's position exceeds the bounds, make it drag only half as far with each mouse movement (like iPhone/iPad behavior)


    /* you don't need this if wrap is true 
if (y > bounds.top) {
mc.y = (y + bounds.top) * 0.5;
} else if (y < bounds.top - yOverlap) {
mc.y = (y + bounds.top - yOverlap) * 0.5;
} else {


}


    */


mc.y = y;


blitMask.update();
var t:uint = getTimer();
//if the frame rate is too high, we won't be able to track the velocity as well, so only update the values 20 times per second
if (t - t2 > 50) {
y2 = y1;
t2 = t1;
y1 = mc.y;
t1 = t;
}
event.updateAfterEvent();
}
Link to comment
Share on other sites

and... VOILA !

 

thank you very much Carl.

it works perfectly.

  • Like 1
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.
×