我正在尝试使用Famo.us框架。 Surface可以将图像作为背景吗?我怎么设置它。我试过了:
// your app here
var bg = new Surface({
properties: {
backgroundImage: "url(images/background.png')"
}
});
答案 0 :(得分:4)
您需要设置曲面的大小。你还可以使用backgroundSize另外设置backgroundImage的大小..这就是我所做的..希望它有所帮助!
var Engine = require('famous/core/Engine');
var Surface = require('famous/core/Surface');
var Modifier = require('famous/core/Modifier');
var context = Engine.createContext();
var surface = new Surface({
size:[200,200],
properties:{
backgroundImage: 'url(content/images/famous_symbol_transparent.png)',
backgroundSize: '200px 200px',
backgroundRepeat: 'no-repeat'
}
});
context.add(new Modifier({origin:[0.5,0.5]})).add(surface);