HTMLcopy
1
<div id="container"></div>
CSScopy
6
1
html, body, #container {
2
width: 100%;
3
height: 100%;
4
margin: 0;
5
padding: 0;
6
}
JavaScriptcopy
x
1
var base = document.createElement('base');
2
base.href = './../../';
3
document.head.appendChild(base);
4
5
var stage = acgraph.create('container');
6
7
// Use relative path to url.
8
acgraph.useAbsoluteReferences(false);
9
10
var gradient = [
11
{
12
offset: 0,
13
color: '#F44336'
14
},
15
{
16
offset: 0.5,
17
color: '#4CAF50'
18
},
19
{
20
offset: 1,
21
color: '#2196F3'
22
}
23
];
24
25
var rectangle = stage.rect(10, 10, 100, 100);
26
rectangle.fill(gradient);