• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

line to line

Explorer ,
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

249

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
Community Expert ,
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();

Votes

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
Explorer ,
Nov 24, 2020 Nov 24, 2020

Copy link to clipboard

Copied

it is work

thanks

Votes

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
Community Expert ,
Nov 24, 2020 Nov 24, 2020

Copy link to clipboard

Copied

LATEST

you're welcome 

Votes

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
LEGEND ,
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

 

Votes

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
Explorer ,
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?

 

Votes

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
LEGEND ,
Nov 23, 2020 Nov 23, 2020

Copy link to clipboard

Copied

Only if you want to see it.

Votes

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