Distorting backGroundPattern
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- Livecode Opensource Backer
- Posts: 10094
- Joined: Fri Feb 19, 2010 10:17 am
Distorting backGroundPattern
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:
-
-
- Attachments
-
- FLIPPER.livecode.zip
- Stack.
- (86.88 KiB) Downloaded 852 times
Re: Distorting backGroundPattern
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
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
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. 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.
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. 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.

Re: Distorting backGroundPattern
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
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
Well, ...
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.richmond62 wrote: ↑Mon Dec 30, 2024 6:37 pmI 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:
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).
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 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.
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
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.
I'll try and track down where, when I get chance on my computer.
Re: Distorting backGroundPattern
A quick test stack attached. Did not try it with the front and back of a playing card.
Craig
Craig
Re: Distorting backGroundPattern
OK, here it is with Richmond's cards.
Craig
Craig
-
- Livecode Opensource Backer
- Posts: 10094
- Joined: Fri Feb 19, 2010 10:17 am
Re: Distorting backGroundPattern
Yes, well, I have already been 'there', but it misses the point which is best illustrated by the following images:
- - -
- - -
-
- Livecode Opensource Backer
- Posts: 10094
- Joined: Fri Feb 19, 2010 10:17 am
Re: Distorting backGroundPattern
I had to make a whole sequence of images in GIMP:
- -
AND, having just discovered this, GIMP goes up in my estimation like nobody's business!
https://www.gimp.org/
- -
AND, having just discovered this, GIMP goes up in my estimation like nobody's business!
https://www.gimp.org/
Last edited by richmond62 on Tue Dec 31, 2024 7:13 pm, edited 1 time in total.
Re: Distorting backGroundPattern
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.
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.

-
- Livecode Opensource Backer
- Posts: 10094
- Joined: Fri Feb 19, 2010 10:17 am
Re: Distorting backGroundPattern
Oh, 19, but I was feeling fancy.
Re: Distorting backGroundPattern
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
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
-
- Livecode Opensource Backer
- Posts: 10094
- Joined: Fri Feb 19, 2010 10:17 am
Re: Distorting backGroundPattern
It is quite a size: I'll pop it up on Dropbox in about 2-3 hours time.
-
- Livecode Opensource Backer
- Posts: 10094
- Joined: Fri Feb 19, 2010 10:17 am
Re: Distorting backGroundPattern
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.
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.