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

Moving masks with Javascript

Explorer ,
Feb 08, 2018 Feb 08, 2018

I'm having problems moving a mask around using javascript, so that only a part of a movieclip in a layer is revealed.

If I go down the built in Animate/Flash route and go to the Timeline, making a layer into a mask.

If the layer is not a mask I can move the this movieclip symbol around referencing:

mask_symbol.x = something...

mask_symbol.y = something...

If I then turn the layer into a mask and use the same code to alter x and y of the movieclip mask, javascript reports an error: "unable to get property 'x' of undefined or null reference"

The movieclip mask is a single frame and two layers.

If I try creating a mask using Createjs code, I can create a mask shape, attach it to a movieclip I want to mask and move the mask  around, but the movieclip to be masked is completely shows nothing, even when the mask shape is positioned over the top of the movieclip that area shows nothing.

I have tried using a bitmap or a shape object in the movieclip to be masked.

1.6K
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 , Feb 08, 2018 Feb 08, 2018

Looks like you and this guy have basically the same question:

Masked Custom Cursor?

Translate
Community Expert ,
Feb 08, 2018 Feb 08, 2018

open your js and check the mask's variable name.  (it's probably mask).  you can control the x property of the mask variable:

mask.x=whatever

and you can use code to create and animate your mask but there are several gotchas including the mask must be created with basic lineto's and curveto's.

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 ,
Feb 08, 2018 Feb 08, 2018
LATEST

Looks like you and this guy have basically the same question:

Masked Custom Cursor?

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