2015-10-13 23 views
0

我試圖在點擊時在Framer.js中創建一個子圖層。我得到的是「Uncaught TypeError:layerD.on不是函數」。如何在Framer.js中單擊動畫子圖層?

我是否在做錯誤或動畫子圖層在Framer中不可行?

下面的代碼:

# Create a background 
new BackgroundLayer backgroundColor: "#28affa" 

# Create layers 
layerC = new Layer 
backgroundColor: "#fff" 
width: 300 
height: 100 

layerD = new Layer 
backgroundColor: "#2889fa" 
width: 150 
height: 100 

layerD.superLayer = layerC 

# Position layers 
layerC.center() 
layerD = layerC.minX 

# Click Event 
layerD.on Events.Click, -> 
    layerD.animate 
    properties: 
     x: this.x + 50 
    curve: "ease" 
    time: 1 

回答

0

當你定位幾層分配一個號碼給layerD變量。您可能想要設置layerD的minX而不是將layerC的minX值分配給layerD。

Fixed Example