JavaScript context translate doesnt work in electron











up vote
0
down vote

favorite












I am using ctx.translate(x, y) to move Camera in canvas game. But for some reason, that doesn't work.



This is what I am using:



setCameraPos: function(x, y) {
//ctx.save()
ctx.translate(x, y)
ctx.setTransform(1, 0, 0, 1, 0, 0)
//ctx.restore()
}


It doesn't work at all. It does not change position of camera.
Any errors? No errors at all.
I am using Electron 3.0.3 Beta.



I accept any libraries.






const canvas = document.getElementById('main')
const ctx = canvas.getContext('2d')


ctx.fillStyle = 'red'
ctx.fillRect(0, 0, 30, 30)
// This doesn't work | VVV
ctx.translate(20, 20)
ctx.setTransform(1, 0, 0, 1, 0, 0)

#main {
background-color: black;
}

<canvas id="main">

</canvas>












share|improve this question




















  • 4




    It would be useful if you would show an example with actual canvas content, and describe what you mean with "It doesn't work".
    – trincot
    Nov 19 at 13:32










  • Changed it. Thanks for pointing it out.
    – Mr.DeleteMyMessages
    Nov 19 at 13:38










  • The setTransform overwrites any previous transforms, like translate
    – Blindman67
    Nov 19 at 13:47










  • Please note that all the transformations are effective on future draw operations and not on past ones
    – axelduch
    Nov 19 at 13:47

















up vote
0
down vote

favorite












I am using ctx.translate(x, y) to move Camera in canvas game. But for some reason, that doesn't work.



This is what I am using:



setCameraPos: function(x, y) {
//ctx.save()
ctx.translate(x, y)
ctx.setTransform(1, 0, 0, 1, 0, 0)
//ctx.restore()
}


It doesn't work at all. It does not change position of camera.
Any errors? No errors at all.
I am using Electron 3.0.3 Beta.



I accept any libraries.






const canvas = document.getElementById('main')
const ctx = canvas.getContext('2d')


ctx.fillStyle = 'red'
ctx.fillRect(0, 0, 30, 30)
// This doesn't work | VVV
ctx.translate(20, 20)
ctx.setTransform(1, 0, 0, 1, 0, 0)

#main {
background-color: black;
}

<canvas id="main">

</canvas>












share|improve this question




















  • 4




    It would be useful if you would show an example with actual canvas content, and describe what you mean with "It doesn't work".
    – trincot
    Nov 19 at 13:32










  • Changed it. Thanks for pointing it out.
    – Mr.DeleteMyMessages
    Nov 19 at 13:38










  • The setTransform overwrites any previous transforms, like translate
    – Blindman67
    Nov 19 at 13:47










  • Please note that all the transformations are effective on future draw operations and not on past ones
    – axelduch
    Nov 19 at 13:47















up vote
0
down vote

favorite









up vote
0
down vote

favorite











I am using ctx.translate(x, y) to move Camera in canvas game. But for some reason, that doesn't work.



This is what I am using:



setCameraPos: function(x, y) {
//ctx.save()
ctx.translate(x, y)
ctx.setTransform(1, 0, 0, 1, 0, 0)
//ctx.restore()
}


It doesn't work at all. It does not change position of camera.
Any errors? No errors at all.
I am using Electron 3.0.3 Beta.



I accept any libraries.






const canvas = document.getElementById('main')
const ctx = canvas.getContext('2d')


ctx.fillStyle = 'red'
ctx.fillRect(0, 0, 30, 30)
// This doesn't work | VVV
ctx.translate(20, 20)
ctx.setTransform(1, 0, 0, 1, 0, 0)

#main {
background-color: black;
}

<canvas id="main">

</canvas>












share|improve this question















I am using ctx.translate(x, y) to move Camera in canvas game. But for some reason, that doesn't work.



This is what I am using:



setCameraPos: function(x, y) {
//ctx.save()
ctx.translate(x, y)
ctx.setTransform(1, 0, 0, 1, 0, 0)
//ctx.restore()
}


It doesn't work at all. It does not change position of camera.
Any errors? No errors at all.
I am using Electron 3.0.3 Beta.



I accept any libraries.






const canvas = document.getElementById('main')
const ctx = canvas.getContext('2d')


ctx.fillStyle = 'red'
ctx.fillRect(0, 0, 30, 30)
// This doesn't work | VVV
ctx.translate(20, 20)
ctx.setTransform(1, 0, 0, 1, 0, 0)

#main {
background-color: black;
}

<canvas id="main">

</canvas>








const canvas = document.getElementById('main')
const ctx = canvas.getContext('2d')


ctx.fillStyle = 'red'
ctx.fillRect(0, 0, 30, 30)
// This doesn't work | VVV
ctx.translate(20, 20)
ctx.setTransform(1, 0, 0, 1, 0, 0)

#main {
background-color: black;
}

<canvas id="main">

</canvas>





const canvas = document.getElementById('main')
const ctx = canvas.getContext('2d')


ctx.fillStyle = 'red'
ctx.fillRect(0, 0, 30, 30)
// This doesn't work | VVV
ctx.translate(20, 20)
ctx.setTransform(1, 0, 0, 1, 0, 0)

#main {
background-color: black;
}

<canvas id="main">

</canvas>






javascript node.js canvas html5-canvas electron






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 19 at 13:34

























asked Nov 19 at 13:30









Mr.DeleteMyMessages

11518




11518








  • 4




    It would be useful if you would show an example with actual canvas content, and describe what you mean with "It doesn't work".
    – trincot
    Nov 19 at 13:32










  • Changed it. Thanks for pointing it out.
    – Mr.DeleteMyMessages
    Nov 19 at 13:38










  • The setTransform overwrites any previous transforms, like translate
    – Blindman67
    Nov 19 at 13:47










  • Please note that all the transformations are effective on future draw operations and not on past ones
    – axelduch
    Nov 19 at 13:47
















  • 4




    It would be useful if you would show an example with actual canvas content, and describe what you mean with "It doesn't work".
    – trincot
    Nov 19 at 13:32










  • Changed it. Thanks for pointing it out.
    – Mr.DeleteMyMessages
    Nov 19 at 13:38










  • The setTransform overwrites any previous transforms, like translate
    – Blindman67
    Nov 19 at 13:47










  • Please note that all the transformations are effective on future draw operations and not on past ones
    – axelduch
    Nov 19 at 13:47










4




4




It would be useful if you would show an example with actual canvas content, and describe what you mean with "It doesn't work".
– trincot
Nov 19 at 13:32




It would be useful if you would show an example with actual canvas content, and describe what you mean with "It doesn't work".
– trincot
Nov 19 at 13:32












Changed it. Thanks for pointing it out.
– Mr.DeleteMyMessages
Nov 19 at 13:38




Changed it. Thanks for pointing it out.
– Mr.DeleteMyMessages
Nov 19 at 13:38












The setTransform overwrites any previous transforms, like translate
– Blindman67
Nov 19 at 13:47




The setTransform overwrites any previous transforms, like translate
– Blindman67
Nov 19 at 13:47












Please note that all the transformations are effective on future draw operations and not on past ones
– axelduch
Nov 19 at 13:47






Please note that all the transformations are effective on future draw operations and not on past ones
– axelduch
Nov 19 at 13:47














1 Answer
1






active

oldest

votes

















up vote
1
down vote



accepted










From what you gave, the translate operation won't work anywhere, not just in Electron.



ctx.setTransform() method sets the transformation matrix to absolute values, the current matrix is discarded and the passed values are the ones to which your matrix will get set.
1, 0, 0, 1, 0, 0 are the values of the native matrix transform (i.e untransformed).



So calling ctx.setTransform(1, 0, 0, 1, 0, 0) will reset your tranform matrix to its default and make all calls to relative translate(), rotate() or transform() useless.



These methods are meant to be relative because they add up to the current matrix values. For instance,



ctx.translate(10, 10);
// here next drawing will be offset by 10px in both x and y direction
ctx.translate(40, -10);
// this adds up to the current 10, 10, so we are now offset by 30, 0


If you want your translate to work, don't call setTransform here, or even replace it with setTransform(1, 0, 0, 1, 20, 20)



Also, in your snippet, you are setting the transformation matrix after you did draw. The transformations will get applied only on next drawings, not on previous ones.



Now, you might be in an animation loop, and need your matrix to get reset at every loop.
In this case, call ctx.setTransform(1,0,0,1,0,0) either at the beginning of your drawing loop, either as the last op, and call translate() before drawing.






const canvas = document.getElementById('main');
const ctx = canvas.getContext('2d');
let x = 0;
ctx.fillStyle = 'red'
anim();

function draw() {
// reset the matrix so we can clear everything
ctx.setTransform(1, 0, 0, 1, 0, 0);
ctx.clearRect(0, 0, canvas.width, canvas.height);
//set the transform before drawing
ctx.translate(x - 30, 20)
//which is actually the same as
//ctx.setTransform(1, 0, 0, 1, x, 20);
ctx.fillRect(0, 0, 30, 30);
}
function anim() {
x = (x + 2) % (canvas.width + 60);
draw();
requestAnimationFrame(anim);
}

#main {
background-color: black;
}

<canvas id="main"></canvas>








share|improve this answer























  • But removing ctx.setTransform glitches canvas.
    – Mr.DeleteMyMessages
    Nov 19 at 13:41










  • @Mr.DeleteMyMessages What do you mean? There is no reason you get any glitches, also, since your edit I saw you were drawing before setting the matrix-transform, feels like your question misses some important clues...
    – Kaiido
    Nov 19 at 13:45










  • Everytime you do ctx.transform it adds value a to x and value b to y.
    – Mr.DeleteMyMessages
    Nov 19 at 13:53










  • yes ctx.transform is "relative", it adds to the current value, setTransform is "absolute" it sets to this value.
    – Kaiido
    Nov 19 at 14:04










  • I made it setTransform before and it worked now.
    – Mr.DeleteMyMessages
    Nov 19 at 14:10











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53375715%2fjavascript-context-translate-doesnt-work-in-electron%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
1
down vote



accepted










From what you gave, the translate operation won't work anywhere, not just in Electron.



ctx.setTransform() method sets the transformation matrix to absolute values, the current matrix is discarded and the passed values are the ones to which your matrix will get set.
1, 0, 0, 1, 0, 0 are the values of the native matrix transform (i.e untransformed).



So calling ctx.setTransform(1, 0, 0, 1, 0, 0) will reset your tranform matrix to its default and make all calls to relative translate(), rotate() or transform() useless.



These methods are meant to be relative because they add up to the current matrix values. For instance,



ctx.translate(10, 10);
// here next drawing will be offset by 10px in both x and y direction
ctx.translate(40, -10);
// this adds up to the current 10, 10, so we are now offset by 30, 0


If you want your translate to work, don't call setTransform here, or even replace it with setTransform(1, 0, 0, 1, 20, 20)



Also, in your snippet, you are setting the transformation matrix after you did draw. The transformations will get applied only on next drawings, not on previous ones.



Now, you might be in an animation loop, and need your matrix to get reset at every loop.
In this case, call ctx.setTransform(1,0,0,1,0,0) either at the beginning of your drawing loop, either as the last op, and call translate() before drawing.






const canvas = document.getElementById('main');
const ctx = canvas.getContext('2d');
let x = 0;
ctx.fillStyle = 'red'
anim();

function draw() {
// reset the matrix so we can clear everything
ctx.setTransform(1, 0, 0, 1, 0, 0);
ctx.clearRect(0, 0, canvas.width, canvas.height);
//set the transform before drawing
ctx.translate(x - 30, 20)
//which is actually the same as
//ctx.setTransform(1, 0, 0, 1, x, 20);
ctx.fillRect(0, 0, 30, 30);
}
function anim() {
x = (x + 2) % (canvas.width + 60);
draw();
requestAnimationFrame(anim);
}

#main {
background-color: black;
}

<canvas id="main"></canvas>








share|improve this answer























  • But removing ctx.setTransform glitches canvas.
    – Mr.DeleteMyMessages
    Nov 19 at 13:41










  • @Mr.DeleteMyMessages What do you mean? There is no reason you get any glitches, also, since your edit I saw you were drawing before setting the matrix-transform, feels like your question misses some important clues...
    – Kaiido
    Nov 19 at 13:45










  • Everytime you do ctx.transform it adds value a to x and value b to y.
    – Mr.DeleteMyMessages
    Nov 19 at 13:53










  • yes ctx.transform is "relative", it adds to the current value, setTransform is "absolute" it sets to this value.
    – Kaiido
    Nov 19 at 14:04










  • I made it setTransform before and it worked now.
    – Mr.DeleteMyMessages
    Nov 19 at 14:10















up vote
1
down vote



accepted










From what you gave, the translate operation won't work anywhere, not just in Electron.



ctx.setTransform() method sets the transformation matrix to absolute values, the current matrix is discarded and the passed values are the ones to which your matrix will get set.
1, 0, 0, 1, 0, 0 are the values of the native matrix transform (i.e untransformed).



So calling ctx.setTransform(1, 0, 0, 1, 0, 0) will reset your tranform matrix to its default and make all calls to relative translate(), rotate() or transform() useless.



These methods are meant to be relative because they add up to the current matrix values. For instance,



ctx.translate(10, 10);
// here next drawing will be offset by 10px in both x and y direction
ctx.translate(40, -10);
// this adds up to the current 10, 10, so we are now offset by 30, 0


If you want your translate to work, don't call setTransform here, or even replace it with setTransform(1, 0, 0, 1, 20, 20)



Also, in your snippet, you are setting the transformation matrix after you did draw. The transformations will get applied only on next drawings, not on previous ones.



Now, you might be in an animation loop, and need your matrix to get reset at every loop.
In this case, call ctx.setTransform(1,0,0,1,0,0) either at the beginning of your drawing loop, either as the last op, and call translate() before drawing.






const canvas = document.getElementById('main');
const ctx = canvas.getContext('2d');
let x = 0;
ctx.fillStyle = 'red'
anim();

function draw() {
// reset the matrix so we can clear everything
ctx.setTransform(1, 0, 0, 1, 0, 0);
ctx.clearRect(0, 0, canvas.width, canvas.height);
//set the transform before drawing
ctx.translate(x - 30, 20)
//which is actually the same as
//ctx.setTransform(1, 0, 0, 1, x, 20);
ctx.fillRect(0, 0, 30, 30);
}
function anim() {
x = (x + 2) % (canvas.width + 60);
draw();
requestAnimationFrame(anim);
}

#main {
background-color: black;
}

<canvas id="main"></canvas>








share|improve this answer























  • But removing ctx.setTransform glitches canvas.
    – Mr.DeleteMyMessages
    Nov 19 at 13:41










  • @Mr.DeleteMyMessages What do you mean? There is no reason you get any glitches, also, since your edit I saw you were drawing before setting the matrix-transform, feels like your question misses some important clues...
    – Kaiido
    Nov 19 at 13:45










  • Everytime you do ctx.transform it adds value a to x and value b to y.
    – Mr.DeleteMyMessages
    Nov 19 at 13:53










  • yes ctx.transform is "relative", it adds to the current value, setTransform is "absolute" it sets to this value.
    – Kaiido
    Nov 19 at 14:04










  • I made it setTransform before and it worked now.
    – Mr.DeleteMyMessages
    Nov 19 at 14:10













up vote
1
down vote



accepted







up vote
1
down vote



accepted






From what you gave, the translate operation won't work anywhere, not just in Electron.



ctx.setTransform() method sets the transformation matrix to absolute values, the current matrix is discarded and the passed values are the ones to which your matrix will get set.
1, 0, 0, 1, 0, 0 are the values of the native matrix transform (i.e untransformed).



So calling ctx.setTransform(1, 0, 0, 1, 0, 0) will reset your tranform matrix to its default and make all calls to relative translate(), rotate() or transform() useless.



These methods are meant to be relative because they add up to the current matrix values. For instance,



ctx.translate(10, 10);
// here next drawing will be offset by 10px in both x and y direction
ctx.translate(40, -10);
// this adds up to the current 10, 10, so we are now offset by 30, 0


If you want your translate to work, don't call setTransform here, or even replace it with setTransform(1, 0, 0, 1, 20, 20)



Also, in your snippet, you are setting the transformation matrix after you did draw. The transformations will get applied only on next drawings, not on previous ones.



Now, you might be in an animation loop, and need your matrix to get reset at every loop.
In this case, call ctx.setTransform(1,0,0,1,0,0) either at the beginning of your drawing loop, either as the last op, and call translate() before drawing.






const canvas = document.getElementById('main');
const ctx = canvas.getContext('2d');
let x = 0;
ctx.fillStyle = 'red'
anim();

function draw() {
// reset the matrix so we can clear everything
ctx.setTransform(1, 0, 0, 1, 0, 0);
ctx.clearRect(0, 0, canvas.width, canvas.height);
//set the transform before drawing
ctx.translate(x - 30, 20)
//which is actually the same as
//ctx.setTransform(1, 0, 0, 1, x, 20);
ctx.fillRect(0, 0, 30, 30);
}
function anim() {
x = (x + 2) % (canvas.width + 60);
draw();
requestAnimationFrame(anim);
}

#main {
background-color: black;
}

<canvas id="main"></canvas>








share|improve this answer














From what you gave, the translate operation won't work anywhere, not just in Electron.



ctx.setTransform() method sets the transformation matrix to absolute values, the current matrix is discarded and the passed values are the ones to which your matrix will get set.
1, 0, 0, 1, 0, 0 are the values of the native matrix transform (i.e untransformed).



So calling ctx.setTransform(1, 0, 0, 1, 0, 0) will reset your tranform matrix to its default and make all calls to relative translate(), rotate() or transform() useless.



These methods are meant to be relative because they add up to the current matrix values. For instance,



ctx.translate(10, 10);
// here next drawing will be offset by 10px in both x and y direction
ctx.translate(40, -10);
// this adds up to the current 10, 10, so we are now offset by 30, 0


If you want your translate to work, don't call setTransform here, or even replace it with setTransform(1, 0, 0, 1, 20, 20)



Also, in your snippet, you are setting the transformation matrix after you did draw. The transformations will get applied only on next drawings, not on previous ones.



Now, you might be in an animation loop, and need your matrix to get reset at every loop.
In this case, call ctx.setTransform(1,0,0,1,0,0) either at the beginning of your drawing loop, either as the last op, and call translate() before drawing.






const canvas = document.getElementById('main');
const ctx = canvas.getContext('2d');
let x = 0;
ctx.fillStyle = 'red'
anim();

function draw() {
// reset the matrix so we can clear everything
ctx.setTransform(1, 0, 0, 1, 0, 0);
ctx.clearRect(0, 0, canvas.width, canvas.height);
//set the transform before drawing
ctx.translate(x - 30, 20)
//which is actually the same as
//ctx.setTransform(1, 0, 0, 1, x, 20);
ctx.fillRect(0, 0, 30, 30);
}
function anim() {
x = (x + 2) % (canvas.width + 60);
draw();
requestAnimationFrame(anim);
}

#main {
background-color: black;
}

<canvas id="main"></canvas>








const canvas = document.getElementById('main');
const ctx = canvas.getContext('2d');
let x = 0;
ctx.fillStyle = 'red'
anim();

function draw() {
// reset the matrix so we can clear everything
ctx.setTransform(1, 0, 0, 1, 0, 0);
ctx.clearRect(0, 0, canvas.width, canvas.height);
//set the transform before drawing
ctx.translate(x - 30, 20)
//which is actually the same as
//ctx.setTransform(1, 0, 0, 1, x, 20);
ctx.fillRect(0, 0, 30, 30);
}
function anim() {
x = (x + 2) % (canvas.width + 60);
draw();
requestAnimationFrame(anim);
}

#main {
background-color: black;
}

<canvas id="main"></canvas>





const canvas = document.getElementById('main');
const ctx = canvas.getContext('2d');
let x = 0;
ctx.fillStyle = 'red'
anim();

function draw() {
// reset the matrix so we can clear everything
ctx.setTransform(1, 0, 0, 1, 0, 0);
ctx.clearRect(0, 0, canvas.width, canvas.height);
//set the transform before drawing
ctx.translate(x - 30, 20)
//which is actually the same as
//ctx.setTransform(1, 0, 0, 1, x, 20);
ctx.fillRect(0, 0, 30, 30);
}
function anim() {
x = (x + 2) % (canvas.width + 60);
draw();
requestAnimationFrame(anim);
}

#main {
background-color: black;
}

<canvas id="main"></canvas>






share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 19 at 14:15

























answered Nov 19 at 13:38









Kaiido

38.1k45597




38.1k45597












  • But removing ctx.setTransform glitches canvas.
    – Mr.DeleteMyMessages
    Nov 19 at 13:41










  • @Mr.DeleteMyMessages What do you mean? There is no reason you get any glitches, also, since your edit I saw you were drawing before setting the matrix-transform, feels like your question misses some important clues...
    – Kaiido
    Nov 19 at 13:45










  • Everytime you do ctx.transform it adds value a to x and value b to y.
    – Mr.DeleteMyMessages
    Nov 19 at 13:53










  • yes ctx.transform is "relative", it adds to the current value, setTransform is "absolute" it sets to this value.
    – Kaiido
    Nov 19 at 14:04










  • I made it setTransform before and it worked now.
    – Mr.DeleteMyMessages
    Nov 19 at 14:10


















  • But removing ctx.setTransform glitches canvas.
    – Mr.DeleteMyMessages
    Nov 19 at 13:41










  • @Mr.DeleteMyMessages What do you mean? There is no reason you get any glitches, also, since your edit I saw you were drawing before setting the matrix-transform, feels like your question misses some important clues...
    – Kaiido
    Nov 19 at 13:45










  • Everytime you do ctx.transform it adds value a to x and value b to y.
    – Mr.DeleteMyMessages
    Nov 19 at 13:53










  • yes ctx.transform is "relative", it adds to the current value, setTransform is "absolute" it sets to this value.
    – Kaiido
    Nov 19 at 14:04










  • I made it setTransform before and it worked now.
    – Mr.DeleteMyMessages
    Nov 19 at 14:10
















But removing ctx.setTransform glitches canvas.
– Mr.DeleteMyMessages
Nov 19 at 13:41




But removing ctx.setTransform glitches canvas.
– Mr.DeleteMyMessages
Nov 19 at 13:41












@Mr.DeleteMyMessages What do you mean? There is no reason you get any glitches, also, since your edit I saw you were drawing before setting the matrix-transform, feels like your question misses some important clues...
– Kaiido
Nov 19 at 13:45




@Mr.DeleteMyMessages What do you mean? There is no reason you get any glitches, also, since your edit I saw you were drawing before setting the matrix-transform, feels like your question misses some important clues...
– Kaiido
Nov 19 at 13:45












Everytime you do ctx.transform it adds value a to x and value b to y.
– Mr.DeleteMyMessages
Nov 19 at 13:53




Everytime you do ctx.transform it adds value a to x and value b to y.
– Mr.DeleteMyMessages
Nov 19 at 13:53












yes ctx.transform is "relative", it adds to the current value, setTransform is "absolute" it sets to this value.
– Kaiido
Nov 19 at 14:04




yes ctx.transform is "relative", it adds to the current value, setTransform is "absolute" it sets to this value.
– Kaiido
Nov 19 at 14:04












I made it setTransform before and it worked now.
– Mr.DeleteMyMessages
Nov 19 at 14:10




I made it setTransform before and it worked now.
– Mr.DeleteMyMessages
Nov 19 at 14:10


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53375715%2fjavascript-context-translate-doesnt-work-in-electron%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Costa Masnaga

Fotorealismo

Sidney Franklin