Page 1 of 1

Distorting backGroundPattern

Posted: Mon Dec 30, 2024 6:37 pm
by richmond62
I am distorting a graphic object to fake a card being flipped, but I am unaware of a way to distort a backGroundPattern so it is congruent with the graphic object as it distorts:
-
Screenshot 2024-12-30 at 19.34.19.jpg

Re: Distorting backGroundPattern

Posted: Mon Dec 30, 2024 7:51 pm
by dunbarx
Richmond.

Not sure what you mean.

In any case, can't you use the "visual effect" command to simulate the action you want? Maybe a "wipe"?

Craig

Re: Distorting backGroundPattern

Posted: Mon Dec 30, 2024 8:05 pm
by bogs
If your talking about the actual background pattern you can apply through properties in Lc to an opaque control, then what your looking to do is not possible
because the image being used will always be displayed as is, your control (polygon most likely) is not going to distort that image in any way, unlike say, a photo editing software would be able too.
Screenshot_2024-12-30_13-53-41.png
it is a flat image you know....
Screenshot_2024-12-30_13-53-41.png (70.06 KiB) Viewed 12296 times
In order to achieve the effect your looking for, you would need a series of images, one for each point of your control's angle.
perspective.png
Lets put this into perspective...

Re: Distorting backGroundPattern

Posted: Mon Dec 30, 2024 8:56 pm
by dunbarx
Bogs.

Are you saying that Richmond wants to "rotate" the card visually, changing from the starting image to the final?

If so it seems to me that you need to narrow the starting image in a second or so down to zero width, and then expand the final image from zero to full width. That should look like you are rotating the image and changing it, like a sleight-of-hand thing.

Richmond?

Craig

Re: Distorting backGroundPattern

Posted: Mon Dec 30, 2024 9:30 pm
by bogs
dunbarx wrote:
Mon Dec 30, 2024 8:56 pm
Bogs.
Are you saying that Richmond wants to "rotate" the card visually, changing from the starting image to the final?
Well, ...
richmond62 wrote:
Mon Dec 30, 2024 6:37 pm
I am distorting a graphic object to fake a card being flipped, but I am unaware of a way to distort a backGroundPattern so it is congruent with the graphic object as it distorts:
it sounds to me like he wants to use a control, likely a N-gon, and have the background image go into perspective just as the n-gon does, as if it were attached to the n-gon's points.

In other words, it would look like the 2nd picture I posted while the n-gon were going through its motion, from flat (top pic) to angled (bottom pic, which I created in GIMP since it has facilities already for perspective).
If so it seems to me that you need to narrow the starting image in a second or so down to zero width, and then expand the final image from zero to full width. That should look like you are rotating the image and changing it, like a sleight-of-hand thing.
Yes, you *would* need to do that, as far as I am aware though, there isn't a built in function to do this in LC. I'm not saying it is impossible to code, but there are simpler ways to do it.

If you had say, 5 images, each skewed in a way that matched your trip in points for the n-gon's transformation, you could then simulate a pretty convincing card turn over.

But let's see what he says, maybe I've missed it completely.

Re: Distorting backGroundPattern

Posted: Mon Dec 30, 2024 10:22 pm
by SparkOut
There's a stack by [-hh] somewhere that does [at least some of] that. Thank you Hermann, RIP.
I'll try and track down where, when I get chance on my computer.

Re: Distorting backGroundPattern

Posted: Mon Dec 30, 2024 11:03 pm
by dunbarx
A quick test stack attached. Did not try it with the front and back of a playing card.

Craig
Flipping.livecode.zip
(1 KiB) Downloaded 774 times

Re: Distorting backGroundPattern

Posted: Mon Dec 30, 2024 11:20 pm
by dunbarx
OK, here it is with Richmond's cards.

Craig
Flipping2.livecode.zip
(86.27 KiB) Downloaded 761 times

Re: Distorting backGroundPattern

Posted: Tue Dec 31, 2024 10:57 am
by richmond62
Yes, well, I have already been 'there', but it misses the point which is best illustrated by the following images:
-
b1.png
-
b6.png
-
b14.png

Re: Distorting backGroundPattern

Posted: Tue Dec 31, 2024 12:14 pm
by richmond62
I had to make a whole sequence of images in GIMP:
-
Screenshot 2024-12-31 at 11.59.21.png
-

AND, having just discovered this, GIMP goes up in my estimation like nobody's business!

https://www.gimp.org/

Re: Distorting backGroundPattern

Posted: Tue Dec 31, 2024 1:04 pm
by bogs
SparkOut wrote:
Mon Dec 30, 2024 10:22 pm
There's a stack by [-hh] somewhere that does [at least some of] that. Thank you Hermann, RIP.
I'll try and track down where, when I get chance on my computer.
Yup, Hermann did this (better than I heh, his contributions were always amazing to me), and this question has come up previously in other formats (engine running comes to mind).

I don't know that there was ever a consensus on the best way, but by far the most approachable way (in that almost anyone could do it with reasonable ease) is having a series of images (doesn't have to be gif, I just use that for the automation built in), and using that for the visual effect.
richmond62 wrote:
Tue Dec 31, 2024 12:14 pm
I had to make a whole sequence of images in GIMP:
A sequence yes, how many did you wind up making total? My testing showed minimum 3 and max 5 necessary for visually smooth flipping motion. Depending on what exact type of thing your trying to do (outside of cards), the number could be as low as 2-3 or as high as 10, but 10 is likely overkill for almost everything aside from progress bar type things.

Re: Distorting backGroundPattern

Posted: Tue Dec 31, 2024 2:35 pm
by richmond62
Oh, 19, but I was feeling fancy.

Re: Distorting backGroundPattern

Posted: Tue Dec 31, 2024 4:41 pm
by dunbarx
Richmond.

Was 19 enough resolution to make the action smooth? My gadget had 80 discrete steps in each direction, which was the minimum I felt in order to look OK.

Can you post yours?

Craig

Re: Distorting backGroundPattern

Posted: Tue Dec 31, 2024 5:06 pm
by richmond62
It is quite a size: I'll pop it up on Dropbox in about 2-3 hours time.

Re: Distorting backGroundPattern

Posted: Tue Dec 31, 2024 6:55 pm
by richmond62
Here the thing is:

https://www.dropbox.com/scl/fi/2niqqi3y ... sc6bi&dl=0

736 KB

Oh, and while I am here: using 10 images does NOT produce any obvious degradation.