chanind / hanzi-writer

Chinese character stroke order animations and practice quizzes
https://hanziwriter.org
MIT License
3.47k stars 539 forks source link

How can I change the character color after finishing a quiz? #225

Open anna-ayn opened 3 years ago

anna-ayn commented 3 years ago

Hello, how can I change the character color after finishing a quiz? For example, I want to draw the strokes with a blue color, then when I finish it, it shows me the character in green.

jamsch commented 3 years ago

Use writer.updateColor in onComplete()

const writer = HanziWriterClass.create("target-id", "我", {
  width: 400,
  height: 400,
});

writer.quiz({
  onComplete() {
    // The color for the highlight animation that pulses in/out for ~1.5s
    writer.updateColor("highlightColor", "#ffc000");
    // Change character stroke color
    writer.updateColor("strokeColor", "#24ff04");
  }
});
anna-ayn commented 3 years ago

Thank you very much!

El jue., 1 abr. 2021 12:04 a. m., jamsch @.***> escribió:

Use writer.updateColor in onComplete()

const writer = HanziWriterClass.create("#element", "上", {

width: 400,

height: 400, });

writer.quiz({

onComplete() {

// The color for the highlight animation that pulses in/out for ~1.5s

writer.updateColor("highlightColor", "#ffc000");

// Change character stroke color

writer.updateColor("strokeColor", "#24ff04");

} });

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/chanind/hanzi-writer/issues/225#issuecomment-811621730, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARPWHFDABF2CGKC5Z3B4JEDTGPWDDANCNFSM4Z5BZWJA .