line to line

New Here ,
Nov 23, 2020 Nov 23, 2020

Copy link to clipboard

Copied

i am trying to draw line in adobe animate html5

i wrote this code, but it is not work

var c = stage.document.getElementById("canvas");
var ctx = c.getContext("2d");
ctx.beginPath();
ctx.moveTo(30,67);
ctx.lineTo(45,78);
ctx.stroke();

Views

86

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Nov 23, 2020 Nov 23, 2020

Copy link to clipboard

Copied

try:

 

var s = new createjs.Shape();
stage.addChild(s);

var g = s.graphics;
g.setStrokeStyle(10);
g.beginStroke("#00ff00");
g.moveTo(30,67);
g.lineTo(45,78);
g.endStroke();

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 24, 2020 Nov 24, 2020

Copy link to clipboard

Copied

it is work

thanks

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Nov 24, 2020 Nov 24, 2020

Copy link to clipboard

Copied

LATEST

you're welcome 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Nov 23, 2020 Nov 23, 2020

Copy link to clipboard

Copied

No. You can't barge in and start drawing on Animate's canvas element using the low-level browser API. Animate owns the canvas, and anything you try to draw on it that way will be immediately clobbered. You have to use the CreateJS API to tell it what you want to draw.

https://www.createjs.com/docs/easeljs/classes/Graphics.html

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 23, 2020 Nov 23, 2020

Copy link to clipboard

Copied

Thanks

 

i wote:

var g = new createjs.Graphics(); g.setStrokeStyle(1); g.beginStroke("#000000"); g.beginFill("red"); g.drawCircle(0,0,30);
but nothing happend.
do i have to do addchild?

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Nov 23, 2020 Nov 23, 2020

Copy link to clipboard

Copied

Only if you want to see it.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines