Monday, 15 October 2012

Oval button

If you want to impress people with super fashion buttons, you can create yourself with few lines of Rebol; no images are needed, Rebol will do all the work for you.
First of all you decide size and gradient, then what happen when the mouse is over the button, and what happen if button is clicked.
See this example:

REBOL [Title: "Ellipse Demo" ]
view layout [
    backdrop silver
    a: box red   "Click me" 100x50
        effect [gradient 0x1 red black oval silver   ]
        feel [
            over: func [face into pos] [
                face/effect: pick   [
                    [gradient 0x-1 red black oval silver   ]
                    [gradient 0x1 red black oval silver   ]
                    ] into
                show face
            engage: func [face action event][
                if action = 'down [
                    face/effect: [ oval silver   ]
                    show face

The code above make a button that invert the gradient when mouse is over it, it becomes red when is pressed.
Your only limit is your imagination.
I suggest you to test the following effects:
  • arrow
  • cross
  • oval
  • round
  • grid

No comments:

Post a Comment