SOURCE CODE: Basic Bevel
VIEW EXAMPLE

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title>Basic Bevel | JavaScript Examples | UIZE JavaScript Framework</title>
  <meta name="keywords" content="Uize.Widget.Bevel"/>
  <meta name="description" content="See how a bevel overlay can be created for an image, where the thickness and opacity of the bevel can be controlled dynamically with slider widgets."/>
  <link rel="alternate" type="application/rss+xml" title="UIZE JavaScript Framework - Latest News" href="http://www.uize.com/latest-news.rss"/>
  <link rel="stylesheet" href="../css/page.css"/>
  <link rel="stylesheet" href="../css/page.example.css"/>
  <link rel="stylesheet" href="css/labeled-horizontal-sliders.css"/>
</head>

<body>

<script type="text/javascript" src="../js/Uize.js"></script>

<h1 class="document-title">
  <a id="page-homeLink" href="../index.html" title="UIZE JavaScript Framework home"></a>
  <a href="../javascript-examples.html" class="breadcrumb breadcrumbWithArrow">JAVASCRIPT EXAMPLES</a>
  Basic Bevel
  <div id="page-actions" class="pageActions">
    <a href="source-code/bevel.html" class="buttonLink">SOURCE</a>
  </div>
</h1>

<div class="main">
  <!-- explanation copy -->

  <div class="explanation">
    <p>In this example, an instance of <a href="../reference/Uize.Widget.Bevel.html"><code>Uize.Widget.Bevel</code></a> is created and is wired to a div that has an image set for its background. The widget overlays a bevel effect on top of the image. Two instances of <a href="../reference/Uize.Widget.Bar.Slider.html"><code>Uize.Widget.Bar.Slider</code></a> are created and their values are wired to control the bevel widget's <code>thickness</code> and <code>opacity</code> properties, respectively. Play around with the two sliders to see the effect.</p>
  </div>

  <!-- page layout's "wireframe" with node for bevel object -->

  <form>
    <table border="0" cellspacing="2" cellpadding="0" style="margin:auto;">
      <tr>
        <td colspan="4">
          <div id="page_bevel" style="position:relative; width:500px; height:357px; background:url(http://rlv.zcache.com/isapi/designall.dll?action=realview&rvtype=pre&view=front&pid=228483162492178759&max_dim=500);"></div>
        </td>
      </tr>
      <tr>
        <td colspan="4" style="height:8px;"></td>
      </tr>
      <tr>
        <td class="sliderLabel">BEVEL THICKNESS</td>
        <td class="sliderValueLabel slideMinValue">0</td>
        <td id="page_bevelThickness"><img src="../images/blank.gif" class="sliderPlaceholder" alt=""/></td>
        <td class="sliderValueLabel sliderMaxValue">30</td>
      </tr>
      <tr>
        <td class="sliderLabel">BEVEL OPACITY</td>
        <td class="sliderValueLabel slideMinValue">0</td>
        <td id="page_bevelOpacity"><img src="../images/blank.gif" class="sliderPlaceholder" alt=""/></td>
        <td class="sliderValueLabel sliderMaxValue">1</td>
      </tr>
    </table>
  </form>
</div>

<!-- JavaScript code to make the static wipe HTML "come alive" -->

<script type="text/javascript">

Uize.module ({
  required:[
    'UizeSite.Page.Example.library',
    'UizeSite.Page.Example',
    'Uize.Widget.Bevel',
    'Uize.Widget.Bar.Slider.xSkin'
  ],
  builder:function () {
    /*** create the example page widget ***/
      var page = window.page = UizeSite.Page.Example ();

    /*** add the Uize.Widget.Bevel child widget ***/
      page.addChild (
        'bevel',
        Uize.Widget.Bevel,
        {
          opacity:.3,
          thickness:8,
          built:false
        }
      );

    /*** set defaults for properties whose values are the same for most sliders ***/
      Uize.Widget.Bar.Slider.set ({
        fullTintColor:'#fff',
        fullTintLevel:60,
        emptyTintColor:'#9aa',
        emptyTintLevel:40,
        borderThickness:1,
        borderTintColor:'#666',
        borderTintLevel:100,
        knobSize:18,
        orientation:'horizontal'
      });

    /*** add the Uize.Widget.Bar.Slider child widget for the bevel thickness selector ***/
      page.addChild (
        'bevelThickness',
        Uize.Widget.Bar.Slider,
        {
          minValue:1,
          maxValue:30,
          value:page.children.bevel.get ('thickness'),
          built:false
        }
      ).wire (
        'Changed.value',
        function (_event) {page.children.bevel.set ({thickness:+_event.source})}
      );

    /*** add the Uize.Widget.Bar.Slider child widget for the bevel opacity selector ***/
      page.addChild (
        'bevelOpacity',
        Uize.Widget.Bar.Slider,
        {
          minValue:0,
          maxValue:1,
          value:page.children.bevel.get ('opacity'),
          increments:0,
          built:false
        }
      ).wire (
        'Changed.value',
        function (_event) {page.children.bevel.set ({opacity:+_event.source})}
      );

    /*** wire up the page widget ***/
      page.wireUi ();
  }
});

</script>

</body>
</html>