|
525
|
1 |
<!DOCTYPE html> |
|
|
2 |
<html lang="en"> |
|
|
3 |
<head> |
|
|
4 |
<meta charset="utf-8"> |
|
|
5 |
<title>Graphics: Radial Gradient Tool</title> |
|
|
6 |
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=PT+Sans:400,700,400italic,700italic"> |
|
|
7 |
<link rel="stylesheet" href="../../build/cssgrids/cssgrids-min.css"> |
|
|
8 |
<link rel="stylesheet" href="../assets/css/main.css"> |
|
|
9 |
<link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css"> |
|
|
10 |
<link rel="shortcut icon" type="image/png" href="../assets/favicon.png"> |
|
|
11 |
<script src="../../build/yui/yui-min.js"></script> |
|
|
12 |
|
|
|
13 |
</head> |
|
|
14 |
<body> |
|
|
15 |
<!-- |
|
|
16 |
<a href="https://github.com/yui/yui3"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub"></a> |
|
|
17 |
--> |
|
|
18 |
<div id="doc"> |
|
|
19 |
<div id="hd"> |
|
|
20 |
<h1><img src="http://yuilibrary.com/img/yui-logo.png"></h1> |
|
|
21 |
</div> |
|
|
22 |
|
|
|
23 |
|
|
|
24 |
<h1>Graphics: Radial Gradient Tool</h1> |
|
|
25 |
<div class="yui3-g"> |
|
|
26 |
<div class="yui3-u-3-4"> |
|
|
27 |
<div id="main"> |
|
|
28 |
<div class="content"><div class="example"> |
|
|
29 |
<style scoped> |
|
|
30 |
.example{ |
|
|
31 |
position: relative; |
|
|
32 |
background-color: #000; |
|
|
33 |
font-family: verdana; |
|
|
34 |
color: #ccc; |
|
|
35 |
height: 250px; |
|
|
36 |
} |
|
|
37 |
|
|
|
38 |
.example #mygraphiccontainer { |
|
|
39 |
position: absolute; |
|
|
40 |
top: 20px; |
|
|
41 |
left: 20px; |
|
|
42 |
width: 250px; |
|
|
43 |
height: 233px; |
|
|
44 |
background-color: #333; |
|
|
45 |
/*border: 3px solid #ff0000;*/ |
|
|
46 |
} |
|
|
47 |
|
|
|
48 |
.example .code-div{ |
|
|
49 |
position: absolute; |
|
|
50 |
top: 70px; |
|
|
51 |
left: 305px; |
|
|
52 |
text-align: left; |
|
|
53 |
} |
|
|
54 |
|
|
|
55 |
.example .code-div label{ |
|
|
56 |
display: inline-block; |
|
|
57 |
color: #ccc; |
|
|
58 |
width: 7em; |
|
|
59 |
text-align: right; |
|
|
60 |
} |
|
|
61 |
|
|
|
62 |
.example #output-grad input{ |
|
|
63 |
width: 5em; |
|
|
64 |
} |
|
|
65 |
|
|
|
66 |
/*gradient controls*/ |
|
|
67 |
.example .grad-c{ |
|
|
68 |
position: absolute; |
|
|
69 |
top: 50px; |
|
|
70 |
left: 50px; |
|
|
71 |
width: 1px; |
|
|
72 |
height: 1px; |
|
|
73 |
cursor: move; |
|
|
74 |
} |
|
|
75 |
|
|
|
76 |
.example .grad-f{ |
|
|
77 |
position: absolute; |
|
|
78 |
top: 40px; |
|
|
79 |
left: 40px; |
|
|
80 |
width: 20px; |
|
|
81 |
height: 20px; |
|
|
82 |
background-color: #ff8800; |
|
|
83 |
-moz-border-radius: 10px; |
|
|
84 |
-webkit-border-radius: 10px; |
|
|
85 |
cursor: move; |
|
|
86 |
} |
|
|
87 |
|
|
|
88 |
.example .grad-r{ /* is contained within .grad-c */ |
|
|
89 |
position: absolute; |
|
|
90 |
top: -50px; |
|
|
91 |
left: -50px; |
|
|
92 |
width: 100px; |
|
|
93 |
height: 100px; |
|
|
94 |
background-color: #300060; |
|
|
95 |
-moz-border-radius: 50px; |
|
|
96 |
-webkit-border-radius: 50px; |
|
|
97 |
opacity: 0.8; |
|
|
98 |
filter: alpha(opacity=80); |
|
|
99 |
} |
|
|
100 |
|
|
|
101 |
.example #grad-control{ |
|
|
102 |
position: relative; |
|
|
103 |
width: 100px; |
|
|
104 |
height: 100px; |
|
|
105 |
border: solid 1px #555; |
|
|
106 |
|
|
|
107 |
} |
|
|
108 |
|
|
|
109 |
.example #grad-control label{ |
|
|
110 |
position: absolute; |
|
|
111 |
width: 100px; |
|
|
112 |
top: 100%; |
|
|
113 |
padding-top: 0.3em; |
|
|
114 |
text-align: center; |
|
|
115 |
color: #555; |
|
|
116 |
} |
|
|
117 |
|
|
|
118 |
.example #output-grad { |
|
|
119 |
position: absolute; |
|
|
120 |
left: 182px; |
|
|
121 |
top: -53px; |
|
|
122 |
width: 200px; |
|
|
123 |
} |
|
|
124 |
|
|
|
125 |
.example #output-grad ul{ |
|
|
126 |
list-style: none; |
|
|
127 |
margin: 0; |
|
|
128 |
padding: 0; |
|
|
129 |
margin-bottom: 1.3em; |
|
|
130 |
} |
|
|
131 |
|
|
|
132 |
.example #output-grad li{ |
|
|
133 |
padding: 0.3em; |
|
|
134 |
} |
|
|
135 |
|
|
|
136 |
.example #output-grad li span { |
|
|
137 |
display: inline-block; |
|
|
138 |
width: 5em; |
|
|
139 |
color: #fff; |
|
|
140 |
margin-left: 0.5em; |
|
|
141 |
} |
|
|
142 |
|
|
|
143 |
.example #panel-content textarea { |
|
|
144 |
width: 100%; |
|
|
145 |
height: 257px; |
|
|
146 |
resize: none; |
|
|
147 |
} |
|
|
148 |
|
|
|
149 |
.example #output-grad .button-item{ |
|
|
150 |
text-align: right; |
|
|
151 |
padding: 1.5em 2.3em 0 0; |
|
|
152 |
} |
|
|
153 |
|
|
|
154 |
</style> |
|
|
155 |
<div id="mygraphiccontainer"> |
|
|
156 |
</div> |
|
|
157 |
<div class="code-div"> |
|
|
158 |
<div id="output-grad"> |
|
|
159 |
<ul> |
|
|
160 |
<li><label>cx:</label> <span id='out-cx'>0.5</span></li> |
|
|
161 |
<li><label>cy:</label> <span id='out-cy'>0.5</span></li> |
|
|
162 |
<li><label>fx:</label> <span id='out-fx'>0.5</span></li> |
|
|
163 |
<li><label>fy:</label> <span id='out-fy'>0.5</span></li> |
|
|
164 |
<li><label>r:</label> <span id='out-r'>0.5</span></li> |
|
|
165 |
<li><label>Center color:</label> <input type="text" id='center-color' value="#ff8800" /></li> |
|
|
166 |
<li><label>Outer color:</label> <input type="text" id='outer-color' value="#300060" /></li> |
|
|
167 |
<li class="button-item"><button id="btn-get-code" class='yui3-button'>Get Code Snippet</button></li> |
|
|
168 |
</ul> |
|
|
169 |
|
|
|
170 |
</div> |
|
|
171 |
<div id="grad-control" title="Represents the boundary of the object"> |
|
|
172 |
<label>Interactive Control</label> |
|
|
173 |
<div class="grad-c"> |
|
|
174 |
<div id="resize-r" class="grad-r" title="Drag to set 'cx,cy' properties. Resize to set 'r' property."></div> |
|
|
175 |
</div> |
|
|
176 |
<div class="grad-f" title="Drag to set 'fx,fy' properties."></div> |
|
|
177 |
</div> |
|
|
178 |
</div> |
|
|
179 |
|
|
|
180 |
<div class="yui3-skin-night"> |
|
|
181 |
<div id="panel-content"> |
|
|
182 |
</div> |
|
|
183 |
</div> |
|
|
184 |
<script src="../assets/graphics/js/radial-tool.js"></script> |
|
|
185 |
|
|
|
186 |
</div> |
|
|
187 |
|
|
|
188 |
<h2>The Radial Gradient Tool</h2> |
|
|
189 |
|
|
|
190 |
<p>The Interactive Control modifies the gradient fill. |
|
|
191 |
As you drag the center dot, or drag or resize the outer disc, |
|
|
192 |
the fill preview updates. You can also see the fill's |
|
|
193 |
property values update. The center color and outer color can also be changed. |
|
|
194 |
These are the colors of the gradient stops. |
|
|
195 |
Click the "Get Code Snippet" button. This code can be copied and pasted |
|
|
196 |
into a graphics instance to reproduce the gradient fill in your code. |
|
|
197 |
</p> |
|
|
198 |
|
|
|
199 |
|
|
|
200 |
<h2>Using the Generated Code</h2> |
|
|
201 |
<p>When you click the "Get Code Snippet" button, generated code is placed |
|
|
202 |
in the text area control. The generated code assumes you will have a separate |
|
|
203 |
page to paste it into. This separate page must contain the following code: |
|
|
204 |
A graphics container such as this,</p> |
|
|
205 |
<pre class="code prettyprint"><div id="mygraphiccontainer"></div></pre> |
|
|
206 |
|
|
|
207 |
<p>CSS such as this,</p> |
|
|
208 |
<pre class="code prettyprint">#mygraphiccontainer { |
|
|
209 |
position: relative; |
|
|
210 |
width: 400px; |
|
|
211 |
height: 400px; |
|
|
212 |
}</pre> |
|
|
213 |
|
|
|
214 |
and a YUI instance containing a <code>Graphics</code> object such as this. |
|
|
215 |
<pre class="code prettyprint">YUI().use('graphics', function (Y) { |
|
|
216 |
|
|
|
217 |
var mygraphic = new Y.Graphic({render:"#mygraphiccontainer"}); |
|
|
218 |
// generated code from the radial gradient tool goes here |
|
|
219 |
|
|
|
220 |
});</pre> |
|
|
221 |
|
|
|
222 |
<p>The tool generates paste-able code for an <code>addShape</code> method that will |
|
|
223 |
create and render an ellipse. You can change this after it's pasted into |
|
|
224 |
your code.</p> |
|
|
225 |
</div> |
|
|
226 |
</div> |
|
|
227 |
</div> |
|
|
228 |
|
|
|
229 |
<div class="yui3-u-1-4"> |
|
|
230 |
<div class="sidebar"> |
|
|
231 |
|
|
|
232 |
|
|
|
233 |
|
|
|
234 |
<div class="sidebox"> |
|
|
235 |
<div class="hd"> |
|
|
236 |
<h2 class="no-toc">Examples</h2> |
|
|
237 |
</div> |
|
|
238 |
|
|
|
239 |
<div class="bd"> |
|
|
240 |
<ul class="examples"> |
|
|
241 |
|
|
|
242 |
|
|
|
243 |
<li data-description="Shows how to create a Graphic instance and add shapes."> |
|
|
244 |
<a href="graphics-simple.html">Basic Graphics Implementation</a> |
|
|
245 |
</li> |
|
|
246 |
|
|
|
247 |
|
|
|
248 |
|
|
|
249 |
<li data-description="Shows how to draw lines and polygons."> |
|
|
250 |
<a href="graphics-path.html">Basic Path</a> |
|
|
251 |
</li> |
|
|
252 |
|
|
|
253 |
|
|
|
254 |
|
|
|
255 |
<li data-description="Shows how to create linear and radial gradient fills."> |
|
|
256 |
<a href="graphics-gradients.html">Create Gradient Fills</a> |
|
|
257 |
</li> |
|
|
258 |
|
|
|
259 |
|
|
|
260 |
|
|
|
261 |
<li data-description="Shows how to add drag to a shape."> |
|
|
262 |
<a href="graphics-drag.html">Basic drag with graphic object</a> |
|
|
263 |
</li> |
|
|
264 |
|
|
|
265 |
|
|
|
266 |
|
|
|
267 |
<li data-description="Shows how to apply transforms to shape."> |
|
|
268 |
<a href="graphics-transforms.html">Using Transforms</a> |
|
|
269 |
</li> |
|
|
270 |
|
|
|
271 |
|
|
|
272 |
|
|
|
273 |
<li data-description="Shows how to use a custom shape with the Graphics module."> |
|
|
274 |
<a href="graphics-customshape.html">Custom Shape</a> |
|
|
275 |
</li> |
|
|
276 |
|
|
|
277 |
|
|
|
278 |
|
|
|
279 |
<li data-description="Shows to use the graphics api to draw a realistic glass."> |
|
|
280 |
<a href="graphics-muddyglass.html">Transparent Glass with Shadow</a> |
|
|
281 |
</li> |
|
|
282 |
|
|
|
283 |
|
|
|
284 |
|
|
|
285 |
<li data-description="Shows to use the graphics api to draw a violin."> |
|
|
286 |
<a href="graphics-violin.html">Complex Drawing: Violin</a> |
|
|
287 |
</li> |
|
|
288 |
|
|
|
289 |
|
|
|
290 |
|
|
|
291 |
|
|
|
292 |
</ul> |
|
|
293 |
</div> |
|
|
294 |
</div> |
|
|
295 |
|
|
|
296 |
|
|
|
297 |
|
|
|
298 |
<div class="sidebox"> |
|
|
299 |
<div class="hd"> |
|
|
300 |
<h2 class="no-toc">Examples That Use This Component</h2> |
|
|
301 |
</div> |
|
|
302 |
|
|
|
303 |
<div class="bd"> |
|
|
304 |
<ul class="examples"> |
|
|
305 |
|
|
|
306 |
|
|
|
307 |
|
|
|
308 |
|
|
|
309 |
|
|
|
310 |
|
|
|
311 |
|
|
|
312 |
|
|
|
313 |
|
|
|
314 |
|
|
|
315 |
|
|
|
316 |
|
|
|
317 |
|
|
|
318 |
|
|
|
319 |
|
|
|
320 |
|
|
|
321 |
|
|
|
322 |
|
|
|
323 |
<li data-description="This example demonstrates animating an element along a curved path using bezier control points."> |
|
|
324 |
<a href="../anim/curve.html">Animating Along a Curved Path</a> |
|
|
325 |
</li> |
|
|
326 |
|
|
|
327 |
|
|
|
328 |
</ul> |
|
|
329 |
</div> |
|
|
330 |
</div> |
|
|
331 |
|
|
|
332 |
</div> |
|
|
333 |
</div> |
|
|
334 |
</div> |
|
|
335 |
</div> |
|
|
336 |
|
|
|
337 |
<script src="../assets/vendor/prettify/prettify-min.js"></script> |
|
|
338 |
<script>prettyPrint();</script> |
|
|
339 |
|
|
|
340 |
<script> |
|
|
341 |
YUI.Env.Tests = { |
|
|
342 |
examples: [], |
|
|
343 |
project: '../assets', |
|
|
344 |
assets: '../assets/graphics', |
|
|
345 |
name: 'graphics', |
|
|
346 |
title: 'Graphics: Radial Gradient Tool', |
|
|
347 |
newWindow: '', |
|
|
348 |
auto: false |
|
|
349 |
}; |
|
|
350 |
YUI.Env.Tests.examples.push('graphics-simple'); |
|
|
351 |
YUI.Env.Tests.examples.push('graphics-path'); |
|
|
352 |
YUI.Env.Tests.examples.push('graphics-gradients'); |
|
|
353 |
YUI.Env.Tests.examples.push('graphics-drag'); |
|
|
354 |
YUI.Env.Tests.examples.push('graphics-transforms'); |
|
|
355 |
YUI.Env.Tests.examples.push('graphics-customshape'); |
|
|
356 |
YUI.Env.Tests.examples.push('graphics-muddyglass'); |
|
|
357 |
YUI.Env.Tests.examples.push('graphics-violin'); |
|
|
358 |
YUI.Env.Tests.examples.push('curve'); |
|
|
359 |
|
|
|
360 |
</script> |
|
|
361 |
<script src="../assets/yui/test-runner.js"></script> |
|
|
362 |
|
|
|
363 |
|
|
|
364 |
|
|
|
365 |
</body> |
|
|
366 |
</html> |