1

I am experimenting with Famo.us framework. Can Surface have image as background? How can i set that. I have tried wth:

   // your app here
    var bg = new Surface({
     properties: {

    backgroundImage: "url(images/background.png')"
  }
    });
Sysrq147
  • 1,359
  • 4
  • 27
  • 49

1 Answers1

4

You need to set the size of the surface. You can also additionally set the size of the backgroundImage with backgroundSize.. Here is what I did.. Hope it helps!

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);
johntraver
  • 3,612
  • 18
  • 17