Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Glimmer » Animation in Glimmer
Animation in Glimmer [message #995] Mon, 14 April 2008 00:21 Go to next message
Andy Maleh is currently offline Andy Maleh
Messages: 28
Registered: July 2009
Junior Member
Nicolas Richeton recently wrote a library for animation called SAT (SWT
Animation Toolkit):
http://nricheton.homeip.net/?p=195

Animation in SAT typically works by launching an effect with specific
parameters. These parameters usually consist of the target widget, start
and end values, duration, movement style, and optional hooks for what
occurs when the event stops or is cancelled by the user.

Some examples of animation effects are changing transperancy (alpha),
resizing, and movement.

This can be easily leveraged in Glimmer. However, before I add support for
it, I'd like to brainstorm a few options for what the syntax will be.

Let's start with a simple example. Below are a few ideas for making a
shell fade out when it is closed. The duration of the effect is 2 seconds
and the effect movement is exponential (relies on ExpoOut class in SAT)

Option 1:

shell {
on_shell_closed {
fade_out {
duration 2.seconds
movement expo_out
}
}
}

Option 2:

shell {
on_shell_closed { fade_out within(2.seconds), with(expo_out) }
}

Option3:

shell {
fade_out_on_shell_closed within(2.seconds), with(expo_out)
}

Note that on_shell_closed is already supported in Glimmer, which is why
I'm leveraging it in Options 1 and 2. Option 3 can still leverage it
behind the scenes by relying on dymanic Ruby evaluation of the code.

What do you think about these options? Could you think of other options or
perhaps improvements to the existing ones?
Re: Animation in Glimmer [message #1027 is a reply to message #995] Fri, 18 April 2008 09:58 Go to previous message
Ketan Padegaonkar is currently offline Ketan Padegaonkar
Messages: 873
Registered: July 2009
Senior Member
Andy Maleh wrote:
> Option 1:
>
> shell {
> on_shell_closed {
> fade_out {
> duration 2.seconds
> movement expo_out
> } }
> }

I like this convention for hooking into events. Any events follow a
similar convention on_closed, on_open, on_minimize, etc. Option 3 is not
such a good idea in this regard.

Also the parameters for the event follow the convention that seems to be
used all over glimmer:

@shell = shell {
text "SWT"
composite {
label {
text "Hello World!"
}
}
}

> Option 2:
>
> shell {
> on_shell_closed { fade_out within(2.seconds), with(expo_out) }
> }

In addition to the event naming convention this improves readability
drastically, it's however not consistent with the way the rest of the
API reads. I'd personally prefer this style of coding since it reads
more like a DSL.

I would definitely like to see more of such API than

> Option3:
>
> shell {
> fade_out_on_shell_closed within(2.seconds), with(expo_out)
> }

This is good DSL like above, but the the event naming convention is not
intuitive.

Cheers,
Ketan Padegaonkar,
http://swtbot.org/ - a functional testing tool for SWT/Eclipse
Re: Animation in Glimmer [message #565604 is a reply to message #995] Fri, 18 April 2008 09:58 Go to previous message
Ketan Padegaonkar is currently offline Ketan Padegaonkar
Messages: 873
Registered: July 2009
Senior Member
Andy Maleh wrote:
> Option 1:
>
> shell {
> on_shell_closed {
> fade_out {
> duration 2.seconds
> movement expo_out
> } }
> }

I like this convention for hooking into events. Any events follow a
similar convention on_closed, on_open, on_minimize, etc. Option 3 is not
such a good idea in this regard.

Also the parameters for the event follow the convention that seems to be
used all over glimmer:

@shell = shell {
text "SWT"
composite {
label {
text "Hello World!"
}
}
}

> Option 2:
>
> shell {
> on_shell_closed { fade_out within(2.seconds), with(expo_out) }
> }

In addition to the event naming convention this improves readability
drastically, it's however not consistent with the way the rest of the
API reads. I'd personally prefer this style of coding since it reads
more like a DSL.

I would definitely like to see more of such API than

> Option3:
>
> shell {
> fade_out_on_shell_closed within(2.seconds), with(expo_out)
> }

This is good DSL like above, but the the event naming convention is not
intuitive.

Cheers,
Ketan Padegaonkar,
http://swtbot.org/ - a functional testing tool for SWT/Eclipse
Previous Topic:Animation in Glimmer
Next Topic:Of Glimmer, SWT... carbon :(
Goto Forum:
  


Current Time: Tue Sep 16 11:38:08 GMT 2014

Powered by FUDForum. Page generated in 0.04660 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software