Skip to main content
December 4, 2016
Answered

How to define opacity in Animate CC Html canvas with coding?

  • December 4, 2016
  • 1 reply
  • 3705 views

I have a picture in html canvas.

I want to change the opacity when I click  on it.....

which js code set the opacity?

[Moved from the non-specific Coding Corner to a product-specific support forum - moderator]

[Although, this possibly might be Edge Animate and not Animate, so please say something if it's in the wrong spot - same moderator]

    This topic has been closed for replies.
    Correct answer ClayUUID

    Attempting to apply CSS styles to CreateJS canvas objects does nothing.

    The correct property to set is alpha.

    1 reply

    Jon Fritz
    Community Expert
    Community Expert
    December 5, 2016

    You could use something like...

    onclick="getElementById('yourimageid').style.opacity = .5"

    ...to change the css style when it's clicked.

    ClayUUIDCorrect answer
    Legend
    February 11, 2017

    Attempting to apply CSS styles to CreateJS canvas objects does nothing.

    The correct property to set is alpha.