1
我有一個視圖(tribeProduct)生成一個包含在滾動視圖中的表面列表,我想要做的是創建一個事件,當視圖是「拖動「下來,動畫開始發揮作用。以下是我迄今爲止由於某種原因無法工作。GenericSync事件沒有初始化視圖 - Famo.us
for (var t = 0; t < tribesLength; t++) {
var tribe = new TribesView({tribes: tribes, tribe: t});
if(tribes[t]['notifications'] > 0) {
// Create view with list of surfaces contained in a scroll view
var tribeProduct = new ProductView({tribes: tribes, tribe: t});
var productModifier = new Modifier({
opacity: 0,
transform: Transform.translate(window.innerWidth * 1, 0, 100)
});
productContext.add(productModifier).add(tribeProduct);
tribe.on('click', function(e) {
var tribeProduct = this[0];
var productModifier = this[1];
productModifier.setOpacity(1, { duration: 500 });
productModifier.setTransform(Transform.translate(0, 0, 100), { duration: 500, curve: Easing.inOutBack });
var handleSwipe = new GenericSync(
['mouse', 'touch'],
{ direction: GenericSync.DIRECTION_Y }
);
tribeProduct.pipe(handleSwipe);
handleSwipe.on('end', (function(data) {
console.log('test');
var position = data.position;
var startPos = 100;
if(position > startPos) {
this
.setOpacity(
0, { duration: 500, curve: 'easeInOut' }
)
.setTransform(
Transform.translate(0, startPos + 200, 0), { duration: 500, curve: 'easeInOut' }
);
}
console.log(position);
}).bind(productModifier));
}.bind([tribeProduct, productModifier]));
}
tribe.pipe(scrollView);
surfaces.push(tribe);
}