Commit f8494e1a5df8667045c20419277444b11364b251

Authored by Agnelo Vaz
1 parent b5d0cb03

Using nicer gradient for background.json script and use border

5 renderers now shown in background.json script
TextLabel
Border
Color
Gradient
Image

Examples updated to use Border renderer new property names

Change-Id: I967e9f4e1ea12a1402b247a49d14ec2681272af7
resources/scripts/background.json
@@ -16,37 +16,38 @@ @@ -16,37 +16,38 @@
16 */ 16 */
17 { 17 {
18 "stage": [ 18 "stage": [
19 - // A TextLabel with a red background 19 + // A TextLabel with a color background
20 { 20 {
21 "type": "TextLabel", 21 "type": "TextLabel",
22 "drawMode": "OVERLAY_2D", 22 "drawMode": "OVERLAY_2D",
23 "text": "Hello World", 23 "text": "Hello World",
24 - "parentOrigin": "TOP_CENTER",  
25 - "anchorPoint": "TOP_CENTER", 24 + "parentOrigin": "TOP_LEFT",
  25 + "anchorPoint": "TOP_LEFT",
26 "pointSize": 20, 26 "pointSize": 20,
27 "horizontalAlignment": "CENTER", 27 "horizontalAlignment": "CENTER",
28 "verticalAlignment": "CENTER", 28 "verticalAlignment": "CENTER",
29 "widthResizePolicy":"FILL_TO_PARENT", 29 "widthResizePolicy":"FILL_TO_PARENT",
30 "heightResizePolicy":"SIZE_RELATIVE_TO_PARENT", 30 "heightResizePolicy":"SIZE_RELATIVE_TO_PARENT",
31 - "sizeModeFactor": [1,0.25,1], 31 + "sizeModeFactor": [ 1.0, 0.33, 1 ],
32 "background":{ 32 "background":{
33 "rendererType": "color", 33 "rendererType": "color",
34 - "blendColor": [1, 0, 0, 1] 34 + "blendColor": [ 0.8, 0, 0.2, 1 ]
35 } 35 }
36 }, 36 },
37 37
38 - // A control with a yellow background 38 + // A control with a border
39 { 39 {
40 "type": "Control", 40 "type": "Control",
41 "relayoutEnabled": false, 41 "relayoutEnabled": false,
42 - "parentOrigin": "CENTER",  
43 - "anchorPoint": "BOTTOM_CENTER",  
44 - "widthResizePolicy":"FILL_TO_PARENT", 42 + "parentOrigin": "CENTER_LEFT",
  43 + "anchorPoint": "CENTER_LEFT",
  44 + "widthResizePolicy":"SIZE_RELATIVE_TO_PARENT",
45 "heightResizePolicy":"SIZE_RELATIVE_TO_PARENT", 45 "heightResizePolicy":"SIZE_RELATIVE_TO_PARENT",
46 - "sizeModeFactor": [1,0.25,1],  
47 - "background":{  
48 - "rendererType": "color",  
49 - "blendColor": [1, 1, 0, 1] 46 + "sizeModeFactor": [ 0.5, 0.33, 1],
  47 + "background": {
  48 + "rendererType" : "border",
  49 + "borderColor" : [ 0.5, 0.5, 0.5, 1 ],
  50 + "borderSize" : 15.0
50 } 51 }
51 }, 52 },
52 53
@@ -54,14 +55,29 @@ @@ -54,14 +55,29 @@
54 { 55 {
55 "type": "Control", 56 "type": "Control",
56 "relayoutEnabled": false, 57 "relayoutEnabled": false,
57 - "parentOrigin": "CENTER",  
58 - "anchorPoint": "TOP_CENTER",  
59 - "widthResizePolicy":"FILL_TO_PARENT", 58 + "parentOrigin": "CENTER_RIGHT",
  59 + "anchorPoint": "CENTER_RIGHT",
  60 + "widthResizePolicy":"SIZE_RELATIVE_TO_PARENT",
60 "heightResizePolicy":"SIZE_RELATIVE_TO_PARENT", 61 "heightResizePolicy":"SIZE_RELATIVE_TO_PARENT",
61 - "sizeModeFactor": [1,0.25,1], 62 + "sizeModeFactor": [ 0.5, 0.33, 1 ],
62 "background": { 63 "background": {
63 "rendererType": "image", 64 "rendererType": "image",
64 - "imageUrl": "{DEMO_IMAGE_DIR}button-background.png" 65 + "imageUrl": "{DEMO_IMAGE_DIR}gallery-large-9.jpg"
  66 + }
  67 + },
  68 +
  69 + // A control with a yellow background
  70 + {
  71 + "type": "Control",
  72 + "relayoutEnabled": false,
  73 + "parentOrigin": "BOTTOM_LEFT",
  74 + "anchorPoint": "BOTTOM_LEFT",
  75 + "widthResizePolicy":"SIZE_RELATIVE_TO_PARENT",
  76 + "heightResizePolicy":"SIZE_RELATIVE_TO_PARENT",
  77 + "sizeModeFactor": [ 0.5, 0.33, 1 ],
  78 + "background":{
  79 + "rendererType": "color",
  80 + "blendColor": [ 1, 1, 0, 1 ]
65 } 81 }
66 }, 82 },
67 83
@@ -69,24 +85,24 @@ @@ -69,24 +85,24 @@
69 { 85 {
70 "type": "Control", 86 "type": "Control",
71 "relayoutEnabled": false, 87 "relayoutEnabled": false,
72 - "parentOrigin": "BOTTOM_CENTER",  
73 - "anchorPoint": "BOTTOM_CENTER",  
74 - "widthResizePolicy":"FILL_TO_PARENT", 88 + "parentOrigin": "BOTTOM_RIGHT",
  89 + "anchorPoint": "BOTTOM_RIGHT",
  90 + "widthResizePolicy":"SIZE_RELATIVE_TO_PARENT",
75 "heightResizePolicy":"SIZE_RELATIVE_TO_PARENT", 91 "heightResizePolicy":"SIZE_RELATIVE_TO_PARENT",
76 - "sizeModeFactor": [1,0.25,1], 92 + "sizeModeFactor": [ 0.5, 0.33, 1.0 ],
77 "background": { 93 "background": {
78 - "rendererType": "gradient",  
79 - "center": [ 0.5, 0.5 ],  
80 - "radius": 1.414,  
81 - "stopOffset": [ 0.0, 0.3, 0.6, 0.8, 1.0 ],  
82 - "stopColor": [  
83 - [ 0.5, 0.78, 0.76, 1.0 ],  
84 - [ 0.77, 0.78, 0.28, 0.48 ],  
85 - [ 0.84, 0.15, 0.55, 0.75 ],  
86 - [ 0.5, 0.78, 0.76, 0.59 ],  
87 - [ 1.0, 1.0, 0.0, 1.0 ]  
88 - ]  
89 - } 94 + "rendererType" : "gradient",
  95 + "startPosition" : [ -0.5, -0.5 ],
  96 + "endPosition": [ 0.5, 0.5 ],
  97 + "stopColor" : [
  98 + [ 1.0, 0.0, 0.0, 1.0 ],
  99 + [ 1.0, 0.25, 0.0, 1.0 ],
  100 + [ 1.0, 0.5, 0.0, 1.0 ],
  101 + [ 1.0, 0.75, 0.0, 1.0 ],
  102 + [ 1.0, 1.0, 0.0, 1.0 ]
  103 + ],
  104 + "stopOffset" : [ 0, 0.25, 0.5, 0.75, 1.0 ]
  105 + }
90 } 106 }
91 ] 107 ]
92 } 108 }
resources/scripts/gradient.json deleted
1 -/*  
2 - * Copyright (c) 2016 Samsung Electronics Co., Ltd.  
3 - *  
4 - * Licensed under the Apache License, Version 2.0 (the "License");  
5 - * you may not use this file except in compliance with the License.  
6 - * You may obtain a copy of the License at  
7 - *  
8 - * http://www.apache.org/licenses/LICENSE-2.0  
9 - *  
10 - * Unless required by applicable law or agreed to in writing, software  
11 - * distributed under the License is distributed on an "AS IS" BASIS,  
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
13 - * See the License for the specific language governing permissions and  
14 - * limitations under the License.  
15 - *  
16 - */  
17 -{  
18 - // a tree of actors  
19 - "stage": [{  
20 - "type": "Control",  
21 - "widthResizePolicy":"FILL_TO_PARENT",  
22 - "heightResizePolicy":"FILL_TO_PARENT",  
23 - "parentOrigin": "CENTER",  
24 - "anchorPoint": "CENTER",  
25 - "background": {  
26 - "rendererType" : "gradient",  
27 - "startPosition" : [-0.5, -0.5],  
28 - "endPosition": [0.5,0.5],  
29 - "stopColor" : [  
30 - [1,0,0,1],  
31 - [1,0.25,0,1],  
32 - [1,0.5,0,1],  
33 - [1,0.75,0,1],  
34 - [1,1,0,1]  
35 - ],  
36 - "stopOffset" : [ 0, 0.25, 0.5, 0.75, 1.0 ]  
37 - }  
38 - }]  
39 -}