Skip to main content

Raffaello_Image

new Raffaello_Image(reference, { imageConfigs })

This is the class to .

Usage

Within the global class
new class {
constructor() {
...

this.myImage = new Raffaello_Image({ url: '/path/to/myImage.png'});
this.webImage = new Raffaello_Image({ url: 'https://images.pexels.com/photos/326900/pexels-photo-326900.jpeg'});

...
}
templateInstructions() {
const thisTemplate = this;

// LAYER X // DRAW IMAGE
this.canvas.addLayer().draw(function() {
// Simple draw
this.drawImage(thisTemplate.myImage.img, 0, 0);

// Draw with specific size
this.drawImage(thisTemplate.webImage.img,
100, 100 // Position
250, 250 // Size
);
});

}
}
At the project root
// At the root
const myImageAtRoot = new Raffaello_Image({ url: '/path/to/myImage.png'});

new class {
constructor() { ... }
templateInstructions() {
const thisTemplate = this;

// LAYER X // DRAW IMAGE
this.canvas.addLayer().draw(function() {
this.drawImage(myImageAtRoot.img, 0, 0);
});

}
}