Code: http://jsfiddle.net/qhoc/8gg7gkqv/
I want the red surface sits flat on top of the gray surface. But you can see the distance (marked ??) between two surfaces when I rotate modifier1
. How to get rid of this "gap"?
JS:
Famous.loaded(function () {
var Engine = Famous.Core.Engine;
var Surface = Famous.Core.Surface;
var Modifier = Famous.Core.Modifier;
var Transform = Famous.Core.Transform;
var StateModifier = Famous.Modifiers.StateModifier;
var Easing = Famous.Transitions.Easing;
var mainContext = Engine.createContext();
mainContext.setPerspective(1000);
var modifier1 = new StateModifier({
size: [200, 200],
align: [0.5, 0.5],
origin: [0.5, 0.5]
});
var surface1 = new Surface({
properties: {
background: 'gray'
}
});
var modifier2 = new StateModifier({
size: [50, 100],
align: [0.5, 0.5],
origin: [0.5, 0.5]
});
var surface2 = new Surface({
properties: {
background: 'red'
}
});
var graphNode = mainContext.add(modifier1);
graphNode.add(surface1);
graphNode.add(modifier2).add(surface2);
modifier1.setTransform(
Transform.rotate(0, Math.PI/2.2, 0),
{ duration: 2000, curve: Easing.outElastic }
);
modifier2.setTransform(
Transform.scale(1, 2, 1),
{ duration: 2000, curve: Easing.outElastic }
);
});