3D icon rotation

This sample shows the use of the angle property within an IconSymbol3DLayer, enhanced by the RotationVariable, to visualize data trends in a 3D SceneView, with rotating arrows indicating positive or negative changes in property values over time.

IconSymbol3DLayer angle

The angle property sets the clockwise rotation (in degrees) of an IconSymbol3DLayer within a PointSymbol3D. This is useful for icons like arrows that can be used in multiple orientations. For instance, an arrow can point in any direction, not just in its default one. In our sample, we set the angle to 90 degrees to make the arrow point upwards initially. This ensures it's correctly positioned for the attribute-driven rotation we'll apply later.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
          // Create a PointSymbol3D with an IconSymbol3DLayer referencing a left pointing arrow image
          const arrowTrendSymbol = {
            type: "point-3d", // autocasts as new PointSymbol3D()
            symbolLayers: [
              {
                type: "icon", // autocasts as new IconSymbol3DLayer()
                size: "30", // points
                resource: {
                  href: arrowSourcePNG
                },
                material: {
                  color: "white"
                },
                angle: 90 // initial clockwise angle in degrees to make the arrow point upwards
              }
            ],
            verticalOffset: {
              // verticalOffset shifts the symbol vertically
              screenLength: 3,
              maxWorldLength: 18,
              minWorldLength: 3
            },
            callout: {
              type: "line", // autocasts as new LineCallout3D()
              color: "white",
              size: 1
            }
          };

RotationVariable

By defining a RotationVariable, we can visually represent trends such as price changes in the housing market by rotating each icon according to a specific attribute value that drives the arrow's rotation. This value is then added to the IconSymbol3DLayer's angle to determine the final rotation.

By using the rotationType property set to arithmetic we achieved a counter-clockwise rotation for the icons. This approach adds 90 degrees to the icon's initial rotation, positioning it to face right. Then the icons rotate counter-clockwise based on the corresponding attribute value. Thanks to this, we can have the following visual representation:

  • 0 degrees: indicates a neutral trend, with the arrow pointing to the right.
  • 0 to 90 degrees: represents a positive trend, with the arrow pointing progressively upwards to the right.
  • 0 to -90 degrees: represents a negative trend, with the arrow pointing progressively downwards to the right.

We also add a ColorVariable to give immediate feedback about the intensity of the trend.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
          // Use Esri color ramp "Red and Green 11" from
          // https://developers.arcgis.com/javascript/latest/visualization/symbols-color-ramps/esri-color-ramps/
          const colors = ["#00ffaaff", "#17a67dff", "#403c35ff", "#b02626ff", "#ff0000ff"];

          // Create the renderer using the PointSymbol3D defined above
          const arrowTrendRenderer = {
            type: "simple", // autocasts as new SimpleRenderer()
            symbol: arrowTrendSymbol,
            visualVariables: [
              // Use RotationVariable to make all the arrows rotated according to the trend values
              {
                type: "rotation", // autocasts as new RotationVariable()
                field: "Property_Value_Diff_Percent", // this attribute represents the positive or negative trend in percentage and it can be associated to a degree of rotation
                rotationType: "arithmetic" // to make the rotation counter clockwise. It also adds 90 degrees to the icon's initial rotation, positioning it to face right
              },
              // Use ColorVariable to color all the arrows according to the trend intensity
              {
                type: "color", // autocasts as new ColorVariable()
                field: "Property_Value_Diff_Percent", // the trend intensity can be represented by this attribute
                stops: [
                  // the trend intensity going from green (positive) to red (negative)
                  { value: 80, color: colors[0] },
                  { value: 10, color: colors[1] },
                  { value: 0, color: colors[2] },
                  { value: -10, color: colors[3] },
                  { value: -80, color: colors[4] }
                ]
              }
            ]
          };

Billboarded icon rotation

This sample shows billboarded rotated icons, which are useful for representing trends or status indicators, as the icons consistently face the camera. The icon billboarding behavior depends on the elevationInfo mode of the FeatureLayer

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
          (buildingsPropertyTrendLayer.elevationInfo = {
            mode: "relative-to-scene" // The elevationInfo mode positions billboarded icons on top of the buildings
          }),

Icons can also be draped on the scene using the on-the-ground elevationInfo mode, in which case the angle can be used to indicate specific directions.

Image preview of related sample Point styles for cities

Point styles for cities

Point styles for cities

Image preview of related sample Thematic multivariate visualization (3D)

Thematic multivariate visualization (3D)

Thematic multivariate visualization (3D)

Image preview of related sample Using callout lines with labels

Using callout lines with labels

Using callout lines with labels

Image preview of related sample Label features using Arcade expressions

Label features using Arcade expressions

Label features using Arcade expressions

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.