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

Make a wipe in javascript that reveals a picture with a mask.

Explorer ,
Mar 26, 2024 Mar 26, 2024

I've been trying to come up with a script to accomplish this task. I've got a script that can make an circle object move to follow the cursor. I've limited the movement from left to right, which is perfect. I've got a second script that creates a box in javascript that can mask a movie in Animate. Just can figure out how to get the two scripts to cooperate. I'm sure there is some Javascript magic that I just can't figure it out. Please help.

TOPICS
Code
656
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

Community Expert , Mar 27, 2024 Mar 27, 2024

you're welcome.

Translate
Community Expert ,
Mar 26, 2024 Mar 26, 2024

make your circle the mask that reveals the pic that you want to reveal.

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
Explorer ,
Mar 26, 2024 Mar 26, 2024

Thanks for the response. The circle does mask, but will not do a wipe.

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
Community Expert ,
Mar 26, 2024 Mar 26, 2024

does the circle move when you swipe?

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
Explorer ,
Mar 26, 2024 Mar 26, 2024

No that's the issue

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
Community Expert ,
Mar 26, 2024 Mar 26, 2024

paste your swipe code here.

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
Explorer ,
Mar 26, 2024 Mar 26, 2024

I will tomorrow thanks

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
Community Expert ,
Mar 26, 2024 Mar 26, 2024

sure.

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
Explorer ,
Mar 26, 2024 Mar 26, 2024

thank you 

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
Explorer ,
Mar 27, 2024 Mar 27, 2024

here is the javascript...

 

createjs.Touch.enable(stage);

 

// the following code draws a fixed box on the stage and makes it a mask of bgmc...

var maskmc = new createjs.Shape();

 

maskmc.graphics.drawRect(0,0,40,50);

maskmc.x = this.bgmc.x;

maskmc.y = this.bgmc.y;

this.bgmc.mask = maskmc;

 

//the next code mades the object "ball" draggable on the x axis...

var root = this;

this.ball.on("pressmove", moveMask );

 

function moveMask(e) {

     var p = stage.globalToLocal(e.stageX, e.stageY);

     e.currentTarget.x = p.x;

}

 

OBJECTS:

movieclip background named: bgmc

movieclip circle named: ball_

 

Thanks for your input.

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
Community Expert ,
Mar 27, 2024 Mar 27, 2024

you're not moving your mask.

 

add maskmc.x=p.x to moveMask()

 

and now, it's not clear what the ball is for.

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
Explorer ,
Mar 27, 2024 Mar 27, 2024

This is fantastic! The answer is so clear a moment after someone points it out! 😉 Thanks so much kglad!!!

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
Community Expert ,
Mar 27, 2024 Mar 27, 2024
LATEST

you're welcome.

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