Page 1 of 1

Custom transform on event statement?

Posted: Sat Nov 09, 2019 8:15 pm
by tim640
Good evening!

So to put it short, there are transform conditions like "on show", "on hide", etc.
I was wondering, is it possible to create your own condition somehow? I need to transform an element, but only if a certain variable is toggled. Ideally, i'd have to be something like:

Code: Select all

transform test1: 

    on show:
        ...
    on hide:
        ...
    if variable == "off":
        ...
    if variable == "on":
        ...
But obviously, this can't work, so i guess there should be a way to define a custom condition here, like you do with user-defined actions i suppose. How do i properly do that? I read the cookbook page about atl transforms, but i couldn't find any real examples of implementing your own conditions.

Thank you in advance!

Re: Custom transform on event statement?

Posted: Sat Nov 09, 2019 8:47 pm
by gas
Introducing such thing will be total chaos... on hide OR with variable == "on"? Both could be possibly True...
Anyway, I'll go inversely, selecting a different transform based on a variable by the screen itself..

Re: Custom transform on event statement?

Posted: Sat Nov 09, 2019 9:45 pm
by tim640
Uh, yeah, my example is a bit confusing, sorry. I'll try to elaborate a bit. I am experimenting with transforms and UI animations to see what is actually possible and how visually appealing and smooth i can make it.

I've got a menu that opens by sliding up on "show", and closes up by sliding back down on "hide". Goes like this:

Code: Select all

transform jumpmenu:
    on show:
        ypos 810
        easein_bounce 0.7 ypos 0
    on replace:
        ypos 0
    on hide:
        easeout_quad 0.2 ypos 810
        linear 0 alpha 0
What i am trying to do is to make it slide up a bit more when you click a menu button so an additional screen with confirmation would be shown under it, and slide back when that additional screen is being hidden, while still retaining it's base "hide" and "show" slide animations. So it has to be a separate specific block in this transform, which wouldn't interrupt the other animations presented...

So what i came up with that imo could work (but then again, i can't find a way to imply it properly), is to create a variable -

Code: Select all

$ slideupmore = "on"
On the screen with the additional information, that is opening when you click a menu button, i put the following code:

Code: Select all

on "show":
        action SetVariable("slideupmore", "on")
on "hide":
        action SetVariable("slideupmore", "off")
So all that's left is to create a condition in the menu transform block, which would slide it up and down accordingly as the information screen is being shown and hidden.
I understand this is not a very elegant way of doing that, but i think it's gonna do what it should so there's that. It also -have- to be a separate screen like that since it's going to contain confirmation options as well. I can't find a better solution to this, since i am a beginner, so that's why i am posting here, uh.

If there's a way of defining a custom condition as i explained in the first post so i could try and also learn how to do such a thing in general (which would be very useful), i'd be extremely grateful for the information! Custom actions are game-changing (lol), knowing how to do custom transform conditions would be a total breakthrough.

Re: Custom transform on event statement?

Posted: Mon Dec 09, 2019 9:22 am
by tim640
Bump, please? It'd rrrreeeeally help a ton.

Or maybe there's a way to write a function to add to the transform that'll define the position?

Re: Custom transform on event statement?

Posted: Mon Dec 09, 2019 10:12 am
by deltadidirac
tim640 wrote:
Sat Nov 09, 2019 9:45 pm
Uh, yeah, my example is a bit confusing, sorry. I'll try to elaborate a bit. I am experimenting with transforms and UI animations to see what is actually possible and how visually appealing and smooth i can make it.

I've got a menu that opens by sliding up on "show", and closes up by sliding back down on "hide". Goes like this:

Code: Select all

transform jumpmenu:
    on show:
        ypos 810
        easein_bounce 0.7 ypos 0
    on replace:
        ypos 0
    on hide:
        easeout_quad 0.2 ypos 810
        linear 0 alpha 0
What i am trying to do is to make it slide up a bit more when you click a menu button so an additional screen with confirmation would be shown under it, and slide back when that additional screen is being hidden, while still retaining it's base "hide" and "show" slide animations. So it has to be a separate specific block in this transform, which wouldn't interrupt the other animations presented...

So what i came up with that imo could work (but then again, i can't find a way to imply it properly), is to create a variable -

Code: Select all

$ slideupmore = "on"
On the screen with the additional information, that is opening when you click a menu button, i put the following code:

Code: Select all

on "show":
        action SetVariable("slideupmore", "on")
on "hide":
        action SetVariable("slideupmore", "off")
So all that's left is to create a condition in the menu transform block, which would slide it up and down accordingly as the information screen is being shown and hidden.
I understand this is not a very elegant way of doing that, but i think it's gonna do what it should so there's that. It also -have- to be a separate screen like that since it's going to contain confirmation options as well. I can't find a better solution to this, since i am a beginner, so that's why i am posting here, uh.

If there's a way of defining a custom condition as i explained in the first post so i could try and also learn how to do such a thing in general (which would be very useful), i'd be extremely grateful for the information! Custom actions are game-changing (lol), knowing how to do custom transform conditions would be a total breakthrough.
Maybe I didn't understand correctly, but the object that has the transformation is the image of the screen?

if so, could it be such a thing ?:

Code: Select all

screen my_screen:
	  on "show" action SetVariable("slideupmore", "on")  ##### here I suppose that the ATL is :[b] transform t-two:[/b] ......
	  add "your_image" at t-two
	  on "hide"  action [SetVariable("slideupmore", "off"), Hide ("your_screen", transform=t-one)]   ############   here I supposed that your ATL is : transform t_one:....
If I understand well, you have not need to use a variable...., but if variable are necessary also for other discriminations so you can write this:

Code: Select all

screen my_screen:
	if slideupmore == on:
		on "hide" action SetVariable("slideupmore", slideupmore=off)
		add "your_image" at t-Two
	else:
		on "show" action SetVariable(sliedeupmore", slideupmore=on)
		on "hide" action SetVariable("slideupmore", slideupmore=off)   ##### write so, the different ATL "t-One" is called by the action that Hide the screen in this way : action [Hide("my_screen", transition/or transform=t_One)]
		add "your_image" at t-Two
try so.... I hope could help you
bye