DIR : /home/kozerus/public_html/pn/uize/site-source/examples/color-pickers-with-gradient.html
/home/kozerus/public_html/pn/uize/site-source/examples
<!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>Color Pickers With Gradient | JavaScript Examples | UIZE JavaScript Framework</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="keywords" content="color Uize.Widgets.RgbSliders.Widget"/>
<meta name="description" content="See a demo of a dynamically generated color gradient, where the two end colors of the gradient can be modified using RGB color pickers with sliders."/>
<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"/>
<style type="text/css">
.swatch {
width:5px;
height:320px;
}
</style>
</head>
<body>
<script type="text/javascript" src="../js/Uize.js"></script>
<h1 class="header">
<a id="page-homeLink" href="../index.html" title="UIZE JavaScript Framework home"></a>
<a href="../index.html" class="homeLinkText" title="UIZE JavaScript Framework home">UIZE JavaScript Framework</a>
</h1>
<div class="main">
<h1 class="document-title">
<a href="../javascript-examples.html" class="breadcrumb breadcrumbWithArrow">JAVASCRIPT EXAMPLES</a>
Color Pickers With Gradient
<div class="pageActionsShell">
<div id="page-actions" class="pageActions"><a href="source-code/color-pickers-with-gradient.html" class="buttonLink">SOURCE</a></div>
</div>
</h1>
<!-- explanation copy -->
<div class="explanation">
<p>This example combines use of two <a href="../reference/Uize.Widgets.RgbSliders.Widget.html"><code>Uize.Widgets.RgbSliders.Widget</code></a> instances with a single <a href="../reference/Uize.Widget.ColorGrid.html"><code>Uize.Widget.ColorGrid</code></a> instance to display a gradient between two colors you select. The color grid is turned into a simple gradient display by setting the value of its <code>divisionsY</code> state property to <code>1</code>, and then using only the <code>colorTopLeft</code> and <code>colorTopRight</code> state properties to change the gradient's color poles.</p>
</div>
<!-- "wireframe" for the UI -->
<table border="0" cellspacing="0" cellpadding="0" style="margin:auto;">
<tr>
<td class="heading">Color 1</td>
<td class="heading">Uize.Widget.ColorGrid Instance</td>
<td class="heading">Color 2</td>
</tr>
<tr>
<td id="page_colorTopLeftPicker" valign="top"></td>
<td id="page_colorCube" valign="top"></td>
<td id="page_colorTopRightPicker" valign="top"></td>
</tr>
</table>
</div>
<!-- JavaScript code to make the static HTML "come alive" -->
<script type="text/javascript">
Uize.require (
[
'UizeSite.Page.Example.library',
'UizeSite.Page.Example',
'Uize.Widgets.RgbSliders.Widget',
'Uize.Widget.ColorGrid',
'Uize.Templates.ColorGrid'
],
function () {
'use strict';
/*** create the example page widget ***/
var page = window.page = UizeSite.Page.Example ();
/*** add the color grid child widget used for the gradient effect ***/
var colorCube = page.addChild (
'colorCube',
Uize.Widget.ColorGrid,
{
divisionsX:100,
divisionsY:1,
colorTopLeft:'ffff00',
colorTopRight:'ff0000',
built:false,
html:Uize.Templates.ColorGrid
}
);
/*** add the color picker child widgets ***/
function setupColorPicker (colorName,initialValue) {
var colorPicker = page.addChild (
colorName + 'Picker',
Uize.Widgets.RgbSliders.Widget,
{
value:colorCube.get (colorName),
built:false
}
);
colorPicker.wire ('Changed.value',function () {colorCube.set (colorName,colorPicker + '')});
}
setupColorPicker ('colorTopLeft');
setupColorPicker ('colorTopRight');
/*** wire up the page widget ***/
page.wireUi ();
}
);
</script>
</body>
</html>
//
koh5_pano
Drag mouse to navigate.
Navigation
- Left/Right Mouse drag: Changes camera heading.
- Up/Sown Mouse drag: Changes camera pitch.
- Scroll wheel: Changes camera field of view.
- I-Key: Displays Info panel with canvas size, image size and FPS.
17.Aug.2010, Martin Wengenmayer