K
K
kazmiruk2013-01-26 16:41:08
JavaScript
kazmiruk, 2013-01-26 16:41:08

How to get rid of white background under animation in Libcanvas?

Implemented an example on Libcanvas. Then I decided to experiment with isometry. I made a simple 2x2 grid. Replaced

ctx.drawImage({
    image : this.animation.get(),
    center: this.shape.center
});

on the
ctx.projectiveImage({
    image : this.animation.get(),
    to: this.shape
});

, where this.shape is a polygon whose points correspond to grid nodes.
The animation appears and plays, but has a white border around it.
image
How can I get rid of it and why does it appear?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
Pavlo Ponomarenko, 2013-01-26
@TheShock

Good afternoon) The problem is most likely that by default, cleaning goes through the “boundingRectangle” of the shape.
Try adding this code to your class and tell me if the bug has been fixed?

clearPrevious: function (ctx) {
    ctx.clear( this.shape );
}

As an alternative, replace boundingShape:
get currentBoundingShape () {
  return this.shape;
}

In theory, any of these methods should help.
From a performance point of view, instead of projectiveImage, which is implemented through many transformations, it is better to use one transformation. For example, as in the topic " Canvas transformations in plain language ".
Better yet, upload already transformed images (it’s easier for a designer, IMHO). Example from Civilization3:

V
Vitaly Zheltyakov, 2013-01-26
@VitaZheltyakov

With this question it is better to address this person.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question