We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#17, #18, #19 介紹完所有 Inputs 模組後,最後來講一般泛用的輸入事件同步模組。
這個輸入事件同步模組,是先前介紹所有模組的集大成。也就是說,你可以用這一個模組來掌控所有前面所敘述過的模組。
GenericSync 提供了一個註冊的靜態方法,當你要使用相關模組時,你必須要把這些模組註冊過,才能夠使用。
GenericSync
define(function(require, exports, module) { var GenericSync = require('famous/inputs/GenericSync'); var ScrollSync = require('famous/inputs/ScrollSync'); var TouchSync = require('famous/inputs/TouchSync'); GenericSync.register({scroll : ScrollSync, touch : TouchSync}); var sync = new GenericSync(['scroll', 'touch'], {direction : GenericSync.DIRECTION_X}); });
setOptions
pipeSync
unpipeSync
addSync
這個例子會在畫面上畫出一個 500x5500 的紅色長方形,當你滑鼠在紅色區塊滾動時,會觸發事件 start,你可以利用事件傳回的資料,來任意移動你的長方形區塊(或是做其他的事情
500x5500
start
define(function(require, exports, module) { // import dependencies var Engine = require('famous/core/Engine'); var Surface = require('famous/core/Surface'); var GenericSync = require('famous/inputs/GenericSync'); var ScrollSync = require('famous/inputs/ScrollSync'); var TouchSync = require('famous/inputs/TouchSync'); GenericSync.register({scroll : ScrollSync, touch : TouchSync}); var mainContext = Engine.createContext(); var sync = new GenericSync(['scroll', 'touch'], {direction : GenericSync.DIRECTION_X}); sync.on('start', function() { console.log(arguments); }); var surface = new Surface({ size: [500, 5500], properties: { backgroundColor: 'red' } }); surface.pipe(sync); mainContext.add(surface); });
The text was updated successfully, but these errors were encountered:
No branches or pull requests
#17, #18, #19 介紹完所有 Inputs 模組後,最後來講一般泛用的輸入事件同步模組。
GenericSync
這個輸入事件同步模組,是先前介紹所有模組的集大成。也就是說,你可以用這一個模組來掌控所有前面所敘述過的模組。
register 靜態方法
GenericSync
提供了一個註冊的靜態方法,當你要使用相關模組時,你必須要把這些模組註冊過,才能夠使用。方法
setOptions
設定設定值pipeSync
將已註冊的同步事件模組傳遞至設定的物件上unpipeSync
在指定物件上註銷同步事件模組addSync
加入指定的同步事件模組範例
這個例子會在畫面上畫出一個
500x5500
的紅色長方形,當你滑鼠在紅色區塊滾動時,會觸發事件start
,你可以利用事件傳回的資料,來任意移動你的長方形區塊(或是做其他的事情The text was updated successfully, but these errors were encountered: