Howto:Dynamic Liveries via Canvas: Difference between revisions

m
→‎Canvas Code: more intuitive to use a hash here ?
m (→‎Canvas Code: more intuitive to use a hash here ?)
Line 66: Line 66:


# vector with all images added (beginning at 0)
# vector with all images added (beginning at 0)
var layers = [];
var layers = {};
# texture path
# texture path
var path="Aircraft/EF2000/Models/";
var path="Aircraft/EF2000/Models/";
foreach(var image; ['EF2000.png','EF2000-dirt.png']) {
foreach(var image; ['EF2000.png','EF2000-dirt.png']) {
# append each added image to a vector so that we can address them later on
# Put a raster image into the canvas and save the image in a hash: layers['EF2000.png].setScale(0.2);
append(layers,
layers[image] = root.createChild("image")
# Put a raster image into the canvas
root.createChild("image")
     .setFile( path~image )
     .setFile( path~image )
     .setSize(2048,2048)
     .setSize(2048,2048)
);
}
}