sliding animations
Posted
#1
(In Topic #1490)
Regular

The last few months I have been working on a personal movie/streaming app. One of my goals was to have a sliding animation effect to cycle through my movie collection…pretty much just like how you cycle (left/right and also up/down) through movies on the Netflix app and also similar to firestick home screen. My idea was sliding panels(filled with buttons and pictureboxes for the movie posters) along the x/y axis, the data for each movie would come from my media server where the movies and mysql db are. You might have seen a lot of my questions here. Lots of you helped me learn a lot including both Bruces and cogier. Cogier even gave me a nice snippet of code for sliding panels. I integrated that into my app but unforunately it didn't mesh well. The panels moved really really slow and it was just unusable. That form did have a lot going on but it made me think that a lot of sliding panels on the x/y axis wasn't the solution. If panels aren't the solution, could someone suggest another direction to go to accomplish this? I was thinking maybe Drawingarea might work? I'm unfamiliar working with Drawingarea so I'm spending today looking for more info and examples.
Posted
Banned
you could hide the scrollbar
add buttons to scroll manually a few images.
Posted
Regular

BruceSteers said
Maybe a ScrollView with Alignment = Align.Horizontal.
you could hide the scrollbar
add buttons to scroll manually a few images.
I think I had a scrollview experiment project at one point. Must have abandoned it but I'll see if I can find it and try again. Thanks Bruce!
Posted
Regular

rj71 said
BruceSteers said
Maybe a ScrollView with Alignment = Align.Horizontal.
you could hide the scrollbar
add buttons to scroll manually a few images.
I think I had a scrollview experiment project at one point. Must have abandoned it but I'll see if I can find it and try again. Thanks Bruce!
I found the scrollview project and I see why I abandoned it. I used scrollview1.scrollX = 25 or whatever number. It just jumps that distance, it doesn't slide in a slight animated way. Also, the items I put inside the panels (picturebox and button) behave differently than if that panel was inside another panel instead of the scrollview its in. I don't think scrollview is the answer either. I will keep experimenting with different things.
Posted
Banned
you'll have to program a simple one.
add more frames and less distance to make it smoother.
Posted
Regular

BruceSteers said
well yeah, there is not a default or built in animation method.
you'll have to program a simple one.
add more frames and less distance to make it smoother.
I'll give that a try. Thanks Bruce.
Posted
Banned
Code (gambas)
I uploaded a video clip..
https://www.youtube.com/shorts/LEDDn-FeRHo?feature=share
Posted
Regular

Wow that looks great. Thanks Bruce. This is what I am looking for I think. I will see if I can get it integrated with the movie data that is fetched from the server and then into the main app.BruceSteers said
This worked okay for me…Code (gambas)
I uploaded a video clip..
https://www.youtube.com/shorts/LEDDn-FeRHo?feature=share
Posted
Regular

Posted
Regular

Form1 - experimenting with dynamic panel creation (thanks again BruceSteers!) with pictureboxes and buttons inside of those. It won't work for you because it is hitting my media server for data and of course my server is not open to the internet. Still working on that and I am not really sure if I will integrate it into the sliding panels. You can sort of see how I'm grabbing data from the server if you're interested.
Form2 - This started with 3 panels that could individually go left/right but an up/down motion moved all 3 panels at the same time. This is what made it slow. I stopped working on Form2 when I had an ipiphany and created Form3 to start over.
Form3 - The idea hit me that I should just put those 3 panels in another container panel and just move that container up/down. Not sure why I didn't think of that sooner. That right there seems to have solved the slowness problem.
I am making progress and I think I'm on the right track but I have several issues that I would appreciate advice on. Read the textarea on form3. I think that lists all the issues.
I'm using cogier's code where he simplified moving along the x/y axis and reduced the amount of code by a huge amount. Thanks cogier!
Posted
Regular

Posted
Regular

Posted
Regular

Posted
Regular

Posted
Regular

Posted
Expert


Try declaring iLoop & iPan as FLOAT.
That may help you find the sweet spot you're looking for.
Cheers - Quin.
I code therefore I am
I code therefore I am
Posted
Banned
/comp/gb.qt4/container/findchild - Gambas Documentation
Posted
Regular

Posted
Regular

Quin,Quincunxian said
Not sure if you can use a value of '19.1' with an integer type.
Try declaring iLoop & iPan as FLOAT.
That may help you find the sweet spot you're looking for.
I tried this and it's the same result. I tried 19.1 through 19.999 and it is still inconsistent.
Silly question, moving along the x/y axis is NOT measured in pixels, correct? Seems like if it were, all I would have to do is calculate the width of the panels inside dypan1 plus the space between panels and use that number as the distance to move dypan1. In cogiers code, that 20 would convert to what in pixels? Am I looking at this the wrong way? I've never really dealt with the x/y axis much.
Posted
Banned
It's also an Integer value so 19, 19.99, 19.9999 are all just Floored Integer 19
Subtracting the X pos of item 1 from item 2 should give the distance.
Dim iDistance As Integer = dypan1.Children[2].X - dypan1.Children[1].X
moving 4 pixels at a time makes it better as you can use a longer wait.
It's less jumpy like that because it moves more.
moving less pixels and using a shorter wait like you do gets glitchy because of the GUI refresh time. (ie the more there is to show the longer it takes and because it's varied as it moves the animation is inconsistent.
So when some objects are off screen the wait is too short.
Trick is to move more and wait more.
Posted
Banned
The order of the Children is not the order you see them.
Meaning dypan1.Children[0] may not be the spacer.
it's Children are in the order in which you added them to the GUI.
If you set dypan1.Arrangement = Arrange.Horizontal then they will be in the correct order as you see them.
I found it very troublesome and preferred ScrollViews with Arrangements set as ScrollView already does everything you want a Panel to do except scroll in a slower animated way.
This works on GTK3 but not on QT5 for some reason.
I re-worked one of your Forms a bit to try to turn many of the repeated methods into one. (much less code)
I've only used 1 Timer.
Made ALL Buttons have the Group "BTN" and work from a single BTN_KeyPress event.
Rather than using explicit Names for the next buttons I use Object.Parent and Container.Children to obtain the next/prev items automatically.
Posted
Regular

BruceSteers said
Yes it is in pixels relative to it's parent container.
It's also an Integer value so 19, 19.99, 19.9999 are all just Floored Integer 19
Subtracting the X pos of item 1 from item 2 should give the distance.
Dim iDistance As Integer = dypan1.Children[2].X - dypan1.Children[1].X
moving 4 pixels at a time makes it better as you can use a longer wait.
It's less jumpy like that because it moves more.
moving less pixels and using a shorter wait like you do gets glitchy because of the GUI refresh time. (ie the more there is to show the longer it takes and because it's varied as it moves the animation is inconsistent.
So when some objects are off screen the wait is too short.
Trick is to move more and wait more.
Oh wow…this looks like it works. I will apply to that project and upload it again later today. Thanks Bruce!
Posted
Banned
Application.Animations = True ?
i'm not sure what that does exactly, possibly it animates scrollview movement ?
Posted
Banned
Posted
Regular

BruceSteers said
just a thought, did you set…
Application.Animations = True ?
i'm not sure what that does exactly, possibly it animates scrollview movement ?
I didn't even know that was a thing.
I am focusing on adding that to the main app and then when I get some time I will upload (where?) a screen recording snippet of the main portion of the app.
Thanks Bruce!
1 guest and 0 members have just viewed this.



