You are not logged in.

servaas

Intermediate

  • "servaas" started this thread

Posts: 218

Location: Belgium

  • Send private message

1

Monday, August 29th 2011, 2:38pm

simple tween

Hello,

on a plugin I have an action that changes the alpha value of a map.

"<plugin name="showhidemap" onclick="toggle_map()"

"<action name="toggle_map">
tween(plugin[map].alpha, 0.2;"

So far, so good.

I searched the forum how to do the opposite (switching between alpha values with the same button (plugin).
The codes I found were rather big ones :-)

Can someone help me with this ?

And a second question :-)
What's the code if i want to change the "x" value of my map ?
(I want to slide it ot the leftside of my window)

Thanks a ton in advance.
=servaas=

servaas

Intermediate

  • "servaas" started this thread

Posts: 218

Location: Belgium

  • Send private message

2

Monday, August 29th 2011, 4:21pm

ok...
So far I found how to change the x value of the map

"<action name="toggle_map">
tween(plugin[map].x, -300, 1.0, easeOutQuad;

</action>"

Now searching how to switch between default setting and the -300..

VN2011

Professional

Posts: 1,336

Location: Duluth MN

  • Send private message

3

Monday, August 29th 2011, 4:31pm

<action name="toggle_map">
IF(plugin[map].alpha == 0.2, tween(alpha, 1.0), tween(alpha, 0.2));
</action>

<action name="slide_map">
IF(plugin[map].x == -300, tween(x, 0), tween(x, -300));
</action>

servaas

Intermediate

  • "servaas" started this thread

Posts: 218

Location: Belgium

  • Send private message

4

Monday, August 29th 2011, 4:45pm

thank you VN2011 ;-)

but..
Your code doesn't interact with the map itself but with the plugin 'showhidemap' ..
And actually it moves -300 but it doesn't come back to 0 when clicking again..

Now i tried this :

Source code

1
2
3
4
<action name="slide_map">
		tween(plugin[map].x, -300, 1.0, easeOutQuad;
		IF(plugin[map].x == -300, tween(x, 0), tween(x, -300));
		</action>


it slides to the left.. but doesn't come back ..

cheers,
=servaas=

servaas

Intermediate

  • "servaas" started this thread

Posts: 218

Location: Belgium

  • Send private message

5

Tuesday, August 30th 2011, 9:48am

*cry* I've spend hour looking how to make this work.... it looks rather easy.. but I don't get it..

A. if i put my action
"tween(plugin[map].x, -300, 1.0, easeOutQuad;"
is slides smoothly yo the left, but off course it doesn't come back ..

B. when my action is
"IF(plugin[map].x == -300, tween(x, 0), tween(x, -300));"
this doesn't influence the map but the button (plugin)
and it doesn't switch between both setting either..

C. when I put
"tween(plugin[map].x, -300, 1.0, easeOutQuad;
IF(plugin[map].x == -300, tween(x, 0), tween(x, -300));"
I have the same problem as A.

I have some great sources codes here and I tried with other solutions but I can't figure out how to make this work... :-(

Any help with this final detail will very appreciated :-)

=servaas=

6

Tuesday, August 30th 2011, 2:47pm

.x, -300, 1.0, easeOutQuad;"
is slides smoothly yo the left, but off course it doesn't come back ..

=servaas=


Maybe like this:

<action name="tween-300">
tween(plugin[map].x, -300, 1.0, easeOutQuad);
set(plugin[thebutton].onclick,action(tween0) );
</action>

<action name="tween0">
tween(plugin[map].x, 0, 1.0, easeOutQuad);
set(plugin[thebutton].onclick,action(tween-300) );
</action>

Set the names correctly in the code for plugins. After clicking the button, tweening -300 starts and it will set new onclickaction to the button and this action will make it tween back to 0. This is what you wanted if i understood correctly?

Regards,

Jesse Passoja
Nelike Imagery
www.inelike.fi
One page portfolio: http://inelike.fi/aiheeton/latest-panoramas/
Jesse Passoja
Passoja design
www.passojadesign.com

VN2011

Professional

Posts: 1,336

Location: Duluth MN

  • Send private message

7

Tuesday, August 30th 2011, 3:07pm

oops you are right its not totally correct. just add another line

<action name="slide_map">
IF(plugin[map].x == -300, tween(x, 0));
IF(plugin[map].x == 0, tween(x, -300));
</action>

servaas

Intermediate

  • "servaas" started this thread

Posts: 218

Location: Belgium

  • Send private message

8

Tuesday, August 30th 2011, 3:45pm

HI Jesse,

Thanks a lot.
It does work perfectly !

=servaas=

VN2011

Professional

Posts: 1,336

Location: Duluth MN

  • Send private message

9

Tuesday, August 30th 2011, 6:28pm

HI Jesse,

Thanks a lot.


No problem :) except name is Dan!

servaas

Intermediate

  • "servaas" started this thread

Posts: 218

Location: Belgium

  • Send private message

10

Tuesday, August 30th 2011, 11:34pm

Hi dan,

Actually i said thanks to the other solution from nelike imagery.
But off course your help is highly appreciated !!

11

Wednesday, August 31st 2011, 7:24am

HI Jesse,

Thanks a lot.
It does work perfectly !

=servaas=


Good that it worked :)

As a matter of fact, Dans solution is even better than mine :) No need to create action at all. Just make the button click check if x = -300, if not, tween -300 and if it is -300 tween back to 0.

Both solutions work the same way so it's up to you which you feel more comfortable to use :)

Regards,

Jesse
Jesse Passoja
Passoja design
www.passojadesign.com

servaas

Intermediate

  • "servaas" started this thread

Posts: 218

Location: Belgium

  • Send private message

12

Wednesday, August 31st 2011, 9:03am

@ Jesse : well actually I prefer the way Dan did it, because it's less code..

but

@ Dan : when I use your code it does make the button (plugin showhidemap) itself moving, not the map.
And the tween to 0 does not work.

Source code

1
<plugin name="showhidemap" "onclick="slide_map"/>

Source code

1
2
3
4
<action name="slide_map">
IF(plugin[map].x == -300, tween(x, 0));
IF(plugin[map].x == 0, tween(x, -300));
</action>


Maybe I do something wrong?

Cheers,
=servaas=

VN2011

Professional

Posts: 1,336

Location: Duluth MN

  • Send private message

13

Wednesday, August 31st 2011, 2:55pm

the code i provided should move what ever plugin is called 'map' is your button called map or is map called map? do you have an online example we could see otherwise post all the map and button code.

14

Wednesday, August 31st 2011, 3:38pm

I believe the issue is you are not telling it to tween the map x.

try this?

<action name="slide_map">
IF(plugin[map].x == -300, tween(plugin[map].x, 0));
IF(plugin[map].x == 0, tween(plugin[map].x, -300));
</action>

VN2011

Professional

Posts: 1,336

Location: Duluth MN

  • Send private message

15

Wednesday, August 31st 2011, 4:44pm

<action name="slide_map">
IF(plugin[map].x == -300, tween(plugin[map].x, 0));
IF(plugin[map].x == 0, tween(plugin[map].x, -300));
</action>


jarreda you found it. what a DUH moment. that would explain why the button was moving. funny how you can look at code for so long and still not see the obvious sometimes. good find. it should work correctly now.

servaas

Intermediate

  • "servaas" started this thread

Posts: 218

Location: Belgium

  • Send private message

16

Thursday, September 1st 2011, 11:04pm

Cool. Thanks, i'll check it first thing in the morning.

servaas

Intermediate

  • "servaas" started this thread

Posts: 218

Location: Belgium

  • Send private message

17

Friday, September 2nd 2011, 1:41pm

I believe the issue is you are not telling it to tween the map x.

try this?

<action name="slide_map">
IF(plugin[map].x == -300, tween(plugin[map].x, 0));
IF(plugin[map].x == 0, tween(plugin[map].x, -300));
</action>


Yep, now it works perfectly !
Thanks !