5
<title>Graphics: Radial Gradient Tool</title>
6
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Maven+Pro:400,700">
7
<link rel="stylesheet" href="../../build/cssgrids/grids-min.css">
8
<link rel="stylesheet" href="../assets/css/main.css">
9
<link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css">
10
<script src="../../build/yui/yui-min.js"></script>
15
<h1>Graphics: Radial Gradient Tool</h1>
20
<div class="yui3-u-3-4">
22
<div class="content"><div class="example">
26
background-color: #000;
32
.example #mygraphiccontainer {
38
background-color: #333;
39
/*border: 3px solid #ff0000;*/
49
.example .code-div label{
50
display: inline-block;
56
.example #output-grad input{
76
background-color: #ff8800;
77
-moz-border-radius: 10px;
78
-webkit-border-radius: 10px;
82
.example .grad-r{ /* is contained within .grad-c */
88
background-color: #300060;
89
-moz-border-radius: 50px;
90
-webkit-border-radius: 50px;
92
filter: alpha(opacity=80);
95
.example #grad-control{
99
border: solid 1px #555;
103
.example #grad-control label{
112
.example #output-grad {
119
.example #output-grad ul{
123
margin-bottom: 1.3em;
126
.example #output-grad li{
130
.example #output-grad li span {
131
display: inline-block;
137
.example #panel-content textarea {
143
.example #output-grad .button-item{
145
padding: 1.5em 2.3em 0 0;
149
<div id="mygraphiccontainer">
151
<div class="code-div">
152
<div id="output-grad">
154
<li><label>cx:</label> <span id='out-cx'>0.5</span></li>
155
<li><label>cy:</label> <span id='out-cy'>0.5</span></li>
156
<li><label>fx:</label> <span id='out-fx'>0.5</span></li>
157
<li><label>fy:</label> <span id='out-fy'>0.5</span></li>
158
<li><label>r:</label> <span id='out-r'>0.5</span></li>
159
<li><label>Center color:</label> <input type="text" id='center-color' value="#ff8800" /></li>
160
<li><label>Outer color:</label> <input type="text" id='outer-color' value="#300060" /></li>
161
<li class="button-item"><button id="btn-get-code" class='yui3-button'>Get Code Snippet</button></li>
165
<div id="grad-control" title="Represents the boundary of the object">
166
<label>Interactive Control</label>
168
<div id="resize-r" class="grad-r" title="Drag to set 'cx,cy' properties. Resize to set 'r' property."></div>
170
<div class="grad-f" title="Drag to set 'fx,fy' properties."></div>
174
<div class="yui3-skin-night">
175
<div id="panel-content">
178
<script src="../assets/graphics/js/radial-tool.js"></script>
182
<h2>The Radial Gradient Tool</h2>
184
<p>The Interactive Control modifies the gradient fill.
185
As you drag the center dot, or drag or resize the outer disc,
186
the fill preview updates. You can also see the fill's
187
property values update. The center color and outer color can also be changed.
188
These are the colors of the gradient stops.
189
Click the "Get Code Snippet" button. This code can be copied and pasted
190
into a graphics instance to reproduce the gradient fill in your code.
194
<h2>Using the Generated Code</h2>
195
<p>When you click the "Get Code Snippet" button, generated code is placed
196
in the text area control. The generated code assumes you will have a separate
197
page to paste it into. This separate page must contain the following code:
198
A graphics container such as this,</p>
199
<pre class="code prettyprint"><div id="mygraphiccontainer"></div></pre>
201
<p>CSS such as this,</p>
202
<pre class="code prettyprint">#mygraphiccontainer {
208
and a YUI instance containing a <code>Graphics</code> object such as this.
209
<pre class="code prettyprint">YUI().use('graphics', function (Y) {
211
var mygraphic = new Y.Graphic({render:"#mygraphiccontainer"});
212
// generated code from the radial gradient tool goes here
216
<p>The tool generates paste-able code for an <code>addShape</code> method that will
217
create and render an ellipse. You can change this after it's pasted into
223
<div class="yui3-u-1-4">
224
<div class="sidebar">
228
<div class="sidebox">
230
<h2 class="no-toc">Examples</h2>
234
<ul class="examples">
237
<li data-description="Shows how to create a Graphic instance and add shapes.">
238
<a href="graphics-simple.html">Basic Graphics Implementation</a>
243
<li data-description="Shows how to draw lines and polygons.">
244
<a href="graphics-path.html">Basic Path</a>
249
<li data-description="Shows how to create linear and radial gradient fills.">
250
<a href="graphics-gradients.html">Create Gradient Fills</a>
255
<li data-description="Shows how to add drag to a shape.">
256
<a href="graphics-drag.html">Basic drag with graphic object</a>
261
<li data-description="Shows how to apply transforms to shape.">
262
<a href="graphics-transforms.html">Using Transforms</a>
267
<li data-description="Shows how to use a custom shape with the Graphics module.">
268
<a href="graphics-customshape.html">Custom Shape</a>
273
<li data-description="Shows to use the graphics api to draw a realistic glass.">
274
<a href="graphics-muddyglass.html">Transparent Glass with Shadow</a>
279
<li data-description="Shows to use the graphics api to draw a violin.">
280
<a href="graphics-violin.html">Complex Drawing: Violin</a>
292
<div class="sidebox">
294
<h2 class="no-toc">Examples That Use This Component</h2>
298
<ul class="examples">
317
<li data-description="This example demonstrates animating an element along a curved path using bezier control points.">
318
<a href="../anim/curve.html">Animating Along a Curved Path</a>
331
<script src="../assets/vendor/prettify/prettify-min.js"></script>
332
<script>prettyPrint();</script>