0
Community Beginner
,
/t5/animate-discussions/why-canvas-width-is-double-in-html-then-adobe-animate-document-width/td-p/13815595
May 24, 2023
May 24, 2023
Copy link to clipboard
Copied
Adobe animate document width is 900 while canvas width is double 1800 in HTML, why is this
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
1 Correct answer
Community Beginner
,
May 25, 2023
May 25, 2023
Yes to some extent, I calculate canvas width and height by multiplying with devicePixelRatio
var pRatio = window.devicePixelRatio || 1;
function handleMouseMove(evt) {
if (oldX) {
drawingCanvas.graphics.beginStroke(color)
.setStrokeStyle(size, "round")
.moveTo(oldX, oldY)
.lineTo(evt.stageX / pRatio, evt.stageY / pRatio);
stage.update();
}
oldX = evt.stageX / pRatio;
oldY = evt.stageY / pRatio;
}
Shabbar28866904fotm
AUTHOR
Community Beginner
,
/t5/animate-discussions/why-canvas-width-is-double-in-html-then-adobe-animate-document-width/m-p/13816591#M365757
May 25, 2023
May 25, 2023
Copy link to clipboard
Copied
it looks like it is due to Window: devicePixelRatio property
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Community Expert
,
/t5/animate-discussions/why-canvas-width-is-double-in-html-then-adobe-animate-document-width/m-p/13816730#M365758
May 25, 2023
May 25, 2023
Copy link to clipboard
Copied
so, your question is answered?
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Community Beginner
,
/t5/animate-discussions/why-canvas-width-is-double-in-html-then-adobe-animate-document-width/m-p/13816960#M365765
May 25, 2023
May 25, 2023
Copy link to clipboard
Copied
Yes to some extent, I calculate canvas width and height by multiplying with devicePixelRatio
var pRatio = window.devicePixelRatio || 1;
function handleMouseMove(evt) {
if (oldX) {
drawingCanvas.graphics.beginStroke(color)
.setStrokeStyle(size, "round")
.moveTo(oldX, oldY)
.lineTo(evt.stageX / pRatio, evt.stageY / pRatio);
stage.update();
}
oldX = evt.stageX / pRatio;
oldY = evt.stageY / pRatio;
}
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Community Expert
,
LATEST
/t5/animate-discussions/why-canvas-width-is-double-in-html-then-adobe-animate-document-width/m-p/13816985#M365767
May 25, 2023
May 25, 2023
Copy link to clipboard
Copied
good to hear.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

