I was trying to modify this example here
https://github.com/Famous/examples/tree/master/src/examples/surfaces/ImageSurface
My goal is make the image under a modifier which is a child of some kind of container. Then I can do setTransform
to this modifier to move the image.
var Engine = require("famous/core/Engine");
var ContainerSurface = require("famous/surfaces/ContainerSurface");
var Modifier = require("famous/core/Modifier");
var ImageSurface = require("famous/surfaces/ImageSurface");
var mainCtx = Engine.createContext();
var image = new ImageSurface({
size: [200, 200]
});
var container = new ContainerSurface({
size: [200, undefined],
properties:{
backgroundColor: 'blue',
overflow: 'hidden'
}
});
image.setContent("content/famous_symbol.svg");
mainCtx.add(container).add(new Modifier({origin: [0, 0]})).add(image);
I was hoping the above code would show the logo on top left and then blue background. But so far I dont see the image appearing at all.
Any help?
UPDATE 1:
I realized doing this work:
container.add(new Modifier({origin: [0, 0]})).add(image);
mainCtx.add(container);
That is kinda weird because I thought it is the same thing as this:
mainCtx.add(container).add(new Modifier({origin: [0, 0]})).add(image);
Can someone tell me the difference?