mirror of
				https://github.com/flynx/PortableMag.git
				synced 2025-10-31 20:10:13 +00:00 
			
		
		
		
	more tweaking of the ribbon scroll...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									3cb185c655
								
							
						
					
					
						commit
						8a3bbc493a
					
				
							
								
								
									
										13
									
								
								layout.js
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								layout.js
									
									
									
									
									
								
							| @ -214,7 +214,8 @@ function handleScrollRelease(evt, data){ | |||||||
| 	var mag = $('.magazine') | 	var mag = $('.magazine') | ||||||
| 	// innertial scroll...
 | 	// innertial scroll...
 | ||||||
| 	// XXX make this generic...
 | 	// XXX make this generic...
 | ||||||
| 	var t = DEFAULT_TRANSITION_DURATION * (1+Math.abs(speed)) | 	//var t = DEFAULT_TRANSITION_DURATION * (1+Math.abs(speed))
 | ||||||
|  | 	var t = DEFAULT_TRANSITION_DURATION | ||||||
| 	// XXX this is only horizontal at this point...
 | 	// XXX this is only horizontal at this point...
 | ||||||
| 	var at = getElementShift(mag).left | 	var at = getElementShift(mag).left | ||||||
| 	var d = MAX_DISTANCE_TO_SCROLL != null ? MAX_DISTANCE_TO_SCROLL : Infinity | 	var d = MAX_DISTANCE_TO_SCROLL != null ? MAX_DISTANCE_TO_SCROLL : Infinity | ||||||
| @ -222,7 +223,8 @@ function handleScrollRelease(evt, data){ | |||||||
| 	var to = (at + (Math.min(Math.abs(t*speed*INNERTIA_SCALE), d) * s)) | 	var to = (at + (Math.min(Math.abs(t*speed*INNERTIA_SCALE), d) * s)) | ||||||
| 	var first = getMagazineOffset(pages.first(), null, 'center') | 	var first = getMagazineOffset(pages.first(), null, 'center') | ||||||
| 	var last = getMagazineOffset(pages.last(), null, 'center') | 	var last = getMagazineOffset(pages.last(), null, 'center') | ||||||
| 	var easing | 
 | ||||||
|  | 	var easing = 'cubic-bezier(0.33,0.66,0.66,1)' | ||||||
| 
 | 
 | ||||||
| 	// filter out really small speeds...
 | 	// filter out really small speeds...
 | ||||||
| 	if(Math.abs(speed) > 0.5){ | 	if(Math.abs(speed) > 0.5){ | ||||||
| @ -235,18 +237,15 @@ function handleScrollRelease(evt, data){ | |||||||
| 			t = Math.abs(t * ((at-first)/(at-to))) | 			t = Math.abs(t * ((at-first)/(at-to))) | ||||||
| 			to = first | 			to = first | ||||||
| 			//easing = 'linear'
 | 			//easing = 'linear'
 | ||||||
| 			easing = 'cubic-bezier(0.33,0.66,0.66,1)' |  | ||||||
| 		} else if(to < last){ | 		} else if(to < last){ | ||||||
| 			// trim the time proportionally...
 | 			// trim the time proportionally...
 | ||||||
| 			var _t = t | 			var _t = t | ||||||
| 			t = Math.abs(t * ((at-last)/(at-to))) | 			t = Math.abs(t * ((at-last)/(at-to))) | ||||||
| 			to = last | 			to = last | ||||||
| 			//easing = 'linear'
 | 			//easing = 'linear'
 | ||||||
| 			easing = 'cubic-bezier(0.33,0.66,0.66,1)' |  | ||||||
| 
 | 
 | ||||||
| 		} else { | 		} else { | ||||||
| 			//easing = 'ease-out'
 | 			//easing = 'ease-out'
 | ||||||
| 			easing = 'cubic-bezier(0.33,0.66,0.66,1)' |  | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		animateElementTo(mag, to, t, easing, speed) | 		animateElementTo(mag, to, t, easing, speed) | ||||||
| @ -258,13 +257,13 @@ function handleScrollRelease(evt, data){ | |||||||
| 			//animateElementTo(mag, first, DEFAULT_TRANSITION_DURATION, 'ease-in')
 | 			//animateElementTo(mag, first, DEFAULT_TRANSITION_DURATION, 'ease-in')
 | ||||||
| 			animateElementTo(mag, first,  | 			animateElementTo(mag, first,  | ||||||
| 					DEFAULT_TRANSITION_DURATION,  | 					DEFAULT_TRANSITION_DURATION,  | ||||||
| 					'cubic-bezier(0.33,0.66,0.66,1)') | 					easing) | ||||||
| 
 | 
 | ||||||
| 		} else if(at < last){ | 		} else if(at < last){ | ||||||
| 			//animateElementTo(mag, last, DEFAULT_TRANSITION_DURATION, 'ease-in')
 | 			//animateElementTo(mag, last, DEFAULT_TRANSITION_DURATION, 'ease-in')
 | ||||||
| 			animateElementTo(mag, last,  | 			animateElementTo(mag, last,  | ||||||
| 					DEFAULT_TRANSITION_DURATION,  | 					DEFAULT_TRANSITION_DURATION,  | ||||||
| 					'cubic-bezier(0.33,0.66,0.66,1)') | 					easing) | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user