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

HTML5 Canvas Gradient Dynamic Text.

Explorer ,
Nov 09, 2018 Nov 09, 2018

Is there a way to do a gradient on dynamic text with HTML5 canvas in Adobe Animate. I could probably get it to work by manually editing the exported HTML but just wondering if there is a way to do it from with in Animate. I am thinking appending CSS to the dynamic text as a way to do it. Has anyone done this.

657
Translate
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

correct answers 1 Correct answer

LEGEND , Nov 09, 2018 Nov 09, 2018

var txt = this.myText;

var fill = canvas.getContext("2d").createLinearGradient(0, 0, 0, txt.getBounds().height);

fill.addColorStop(0, "#F00");

fill.addColorStop(0.5, "#0F0");

fill.addColorStop(1, "#00F");

txt.color = fill;

CanvasRenderingContext2D.createLinearGradient() - Web APIs | MDN

Translate
LEGEND ,
Nov 09, 2018 Nov 09, 2018
Translate
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 09, 2018 Nov 09, 2018
LATEST

var txt = this.myText;

var fill = canvas.getContext("2d").createLinearGradient(0, 0, 0, txt.getBounds().height);

fill.addColorStop(0, "#F00");

fill.addColorStop(0.5, "#0F0");

fill.addColorStop(1, "#00F");

txt.color = fill;

CanvasRenderingContext2D.createLinearGradient() - Web APIs | MDN

Translate
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