Commit 8c0d7116b8367e50f834eedd5d0b9bc02e74a8eb
[dali_1.3.1] Merge branch 'devel/master'
Change-Id: I120eac7ba19538802415d1099d12954999b3d367
Showing
21 changed files
with
1423 additions
and
1 deletions
build/tizen/CMakeLists.txt
| @@ -109,6 +109,7 @@ CONFIGURE_FILE( resources-location.in ${DEMO_SHARED}/resources-location.cpp ) | @@ -109,6 +109,7 @@ CONFIGURE_FILE( resources-location.in ${DEMO_SHARED}/resources-location.cpp ) | ||
| 109 | 109 | ||
| 110 | #Replace @DEMO_STYLE_IMAGE_DIR@ in following files | 110 | #Replace @DEMO_STYLE_IMAGE_DIR@ in following files |
| 111 | CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/demo-theme.json.in ${LOCAL_STYLE_DIR}/demo-theme.json ) | 111 | CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/demo-theme.json.in ${LOCAL_STYLE_DIR}/demo-theme.json ) |
| 112 | +CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/animated-gradient-call-active-style.json.in ${LOCAL_STYLE_DIR}/animated-gradient-call-active-style.json ) | ||
| 112 | CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/contact-cards-example-theme.json.in ${LOCAL_STYLE_DIR}/contact-cards-example-theme.json ) | 113 | CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/contact-cards-example-theme.json.in ${LOCAL_STYLE_DIR}/contact-cards-example-theme.json ) |
| 113 | CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/progress-bar-example-theme.json.in ${LOCAL_STYLE_DIR}/progress-bar-example-theme.json ) | 114 | CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/progress-bar-example-theme.json.in ${LOCAL_STYLE_DIR}/progress-bar-example-theme.json ) |
| 114 | CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/simple-example-theme.json.in ${LOCAL_STYLE_DIR}/simple-example-theme.json ) | 115 | CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/simple-example-theme.json.in ${LOCAL_STYLE_DIR}/simple-example-theme.json ) |
com.samsung.dali-demo.xml
| @@ -238,6 +238,12 @@ | @@ -238,6 +238,12 @@ | ||
| 238 | <ui-application appid="property-notification.example" exec="/usr/apps/com.samsung.dali-demo/bin/property-notification.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> | 238 | <ui-application appid="property-notification.example" exec="/usr/apps/com.samsung.dali-demo/bin/property-notification.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> |
| 239 | <label>Property Notification</label> | 239 | <label>Property Notification</label> |
| 240 | </ui-application> | 240 | </ui-application> |
| 241 | + <ui-application appid="animated-gradient-call-active.example" exec="/usr/apps/com.samsung.dali-demo/bin/animated-gradient-call-active.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> | ||
| 242 | + <label>Call Active App</label> | ||
| 243 | + </ui-application> | ||
| 244 | + <ui-application appid="animated-gradient-card-active.example" exec="/usr/apps/com.samsung.dali-demo/bin/animated-gradient-card-active.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> | ||
| 245 | + <label>Card Active App</label> | ||
| 246 | + </ui-application> | ||
| 241 | <ui-application appid="image-policies.example" exec="/usr/apps/com.samsung.dali-demo/bin/image-policies.example" nodisplay="true" multiple="false" taskmanage="true" type="c++app"> | 247 | <ui-application appid="image-policies.example" exec="/usr/apps/com.samsung.dali-demo/bin/image-policies.example" nodisplay="true" multiple="false" taskmanage="true" type="c++app"> |
| 242 | <label>Image Policies</label></ui-application> | 248 | <label>Image Policies</label></ui-application> |
| 243 | <privileges> | 249 | <privileges> |
demo/dali-demo.cpp
| @@ -50,6 +50,8 @@ int DALI_EXPORT_API main(int argc, char **argv) | @@ -50,6 +50,8 @@ int DALI_EXPORT_API main(int argc, char **argv) | ||
| 50 | demo.AddExample(Example("sparkle.example", DALI_DEMO_STR_TITLE_SPARKLE)); | 50 | demo.AddExample(Example("sparkle.example", DALI_DEMO_STR_TITLE_SPARKLE)); |
| 51 | demo.AddExample(Example("rendering-skybox.example", DALI_DEMO_STR_TITLE_SKYBOX)); | 51 | demo.AddExample(Example("rendering-skybox.example", DALI_DEMO_STR_TITLE_SKYBOX)); |
| 52 | demo.AddExample(Example("rendering-basic-pbr.example", DALI_DEMO_STR_TITLE_PBR)); | 52 | demo.AddExample(Example("rendering-basic-pbr.example", DALI_DEMO_STR_TITLE_PBR)); |
| 53 | + demo.AddExample(Example("animated-gradient-call-active.example", DALI_DEMO_STR_TITLE_CALL_ACTIVE)); | ||
| 54 | + demo.AddExample(Example("animated-gradient-card-active.example", DALI_DEMO_STR_TITLE_CARD_ACTIVE)); | ||
| 53 | 55 | ||
| 54 | demo.SortAlphabetically( true ); | 56 | demo.SortAlphabetically( true ); |
| 55 | 57 |
examples/animated-gradient-call-active/animated-gradient-call-active.cpp
0 → 100644
| 1 | +/* | ||
| 2 | +* Copyright (c) 2017 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 | +#include <dali/dali.h> | ||
| 18 | +#include <dali-toolkit/dali-toolkit.h> | ||
| 19 | +#include <iostream> | ||
| 20 | +#include <dali-toolkit/devel-api/visuals/animated-gradient-visual-properties-devel.h> | ||
| 21 | +#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h> | ||
| 22 | +#include <dali/integration-api/debug.h> | ||
| 23 | + | ||
| 24 | +using namespace Dali; | ||
| 25 | +using namespace Dali::Toolkit; | ||
| 26 | + | ||
| 27 | +// This example shows how to create and display animated-gradient-effect | ||
| 28 | +// | ||
| 29 | +namespace | ||
| 30 | +{ | ||
| 31 | +// The value for scale-change between wearable-mobile | ||
| 32 | +// Can be changed on App-Create time | ||
| 33 | +Vector2 STAGE_SIZE = Vector2( 360.0f, 360.0f ); | ||
| 34 | +Vector2 SCALED_STAGE_SIZE = Vector2( 1.0f, 1.0f ); | ||
| 35 | +Vector3 SCALED_STAGE_SIZE_3 = Vector3( 1.0f, 1.0f, 0.0f ); | ||
| 36 | +float SCALED_WIDTH = 1.0f; | ||
| 37 | +float SCALED_HEIGHT = 1.0f; | ||
| 38 | +float FONT_SCALE = 0.25f; | ||
| 39 | + | ||
| 40 | +// const parameters for animations | ||
| 41 | +const float CHANGE_DURATION = 0.2f; | ||
| 42 | + | ||
| 43 | +// const parameters for icon position and size when resolution is 360x360 | ||
| 44 | +const Vector2 ICON_CALL_SIZE = Vector2( 54.0f, 54.0f ); | ||
| 45 | +const Vector3 ICON_CALL_POSITION = Vector3( 0.0f, 0.0f, 0.0f ); | ||
| 46 | +const Vector2 ICON_DECALL_SIZE = Vector2( 54.0f, 54.0f ); | ||
| 47 | +const Vector3 ICON_DECALL_POSITION = Vector3( 141.0f, 0.0f, 0.0f ); | ||
| 48 | +const Vector2 ICON_BATTERY_SIZE = Vector2( 14.0f, 23.0f ); | ||
| 49 | +const Vector3 ICON_BATTERY_POSITION = Vector3( 0.0f, 25.5f, 0.0f ); | ||
| 50 | +const Vector2 BUTTON_CALL_START_SIZE = Vector2( 54.0f, 54.0f ); | ||
| 51 | +const Vector3 BUTTON_CALL_START_POSITION = Vector3( -141.0f, 0.0f, 0.0f ); | ||
| 52 | + | ||
| 53 | +const Vector2 BUTTON_DECALL_ICON_SIZE = Vector2( 62.0f, 62.0f ); | ||
| 54 | +const Vector3 BUTTON_DECALL_ICON_POSITION = Vector3( 0.0f, 0.0f, 0.0f ); | ||
| 55 | +const Vector2 BUTTON_DECALL_SIZE = Vector2( 360.0f, 82.0f ); | ||
| 56 | +const Vector3 BUTTON_DECALL_CLIP_POSITION = Vector3( 0.0f, 82.0f, 0.0f ); | ||
| 57 | +const Vector3 BUTTON_DECALL_POSITION = Vector3( 0.0f, 0.0f, 0.0f ); | ||
| 58 | + | ||
| 59 | +// icon image name | ||
| 60 | +const char * const ICON_CALL_IMAGE( DEMO_IMAGE_DIR "Call_Accept.png" ); | ||
| 61 | +const char * const ICON_DECALL_IMAGE( DEMO_IMAGE_DIR "Call_Decline.png" ); | ||
| 62 | +const char * const ICON_BATTERY_IMAGE( DEMO_IMAGE_DIR "Call_Battery.png" ); | ||
| 63 | +const char * const BUTTON_DECALL_ICON_IMAGE( DEMO_IMAGE_DIR "Call_Decline_wh.png" ); | ||
| 64 | + | ||
| 65 | +// const parameters for string position and size and font-size when resolution is 360x360 | ||
| 66 | +const Vector2 LABEL_INCOMING_SIZE = Vector2( 156.0f, 26.0f ); | ||
| 67 | +const Vector3 LABEL_INCOMING_POSITION = Vector3( 0.0f, -47.0f, 0.0f ); | ||
| 68 | +const Vector4 LABEL_INCOMING_FONT_COLOR = Vector4( 0.98f, 0.98f, 0.98f, 1.0f ); | ||
| 69 | +const float LABEL_INCOMING_FONT_SIZE = 21.39f; | ||
| 70 | +const Vector2 LABEL_NAME_SIZE = Vector2( 230.0f, 45.0f ); | ||
| 71 | +const Vector3 LABEL_NAME_POSITION = Vector3( 0.0f, -2.5f, 0.0f ); | ||
| 72 | +const Vector4 LABEL_NAME_FONT_COLOR = Vector4( 0.98f, 0.98f, 0.98f, 1.0f ); | ||
| 73 | +const float LABEL_NAME_FONT_SIZE = 37.71f; | ||
| 74 | +const Vector2 LABEL_NUMBER_SIZE = Vector2( 196.0f, 25.0f ); | ||
| 75 | +const Vector3 LABEL_NUMBER_POSITION = Vector3( 0.0f, 31.0f, 0.0f ); | ||
| 76 | +const Vector4 LABEL_NUMBER_FONT_COLOR = Vector4( 0.98f, 0.98f, 0.98f, 1.0f ); | ||
| 77 | +const float LABEL_NUMBER_FONT_SIZE = 20.55f; | ||
| 78 | +const Vector2 LABEL_DECLINE_SIZE = Vector2( 203.0f, 25.0f ); | ||
| 79 | +const Vector3 LABEL_DECLINE_POSITION = Vector3( 0.0f, -50.5f, 0.0f ); | ||
| 80 | +const Vector4 LABEL_DECLINE_FONT_COLOR = Vector4( 0.98f, 0.98f, 0.98f, 1.0f ); | ||
| 81 | +const float LABEL_DECLINE_FONT_SIZE = 20.55f; | ||
| 82 | +const Vector2 LABEL_TIME_SIZE = Vector2( 91.0f, 26.0f ); | ||
| 83 | +const Vector3 LABEL_TIME_POSITION = Vector3( 0.0f, -47.0f, 0.0f ); | ||
| 84 | +const Vector4 LABEL_TIME_FONT_COLOR = Vector4( 0.98f, 0.98f, 0.98f, 1.0f ); | ||
| 85 | +const float LABEL_TIME_FONT_SIZE = 21.39f; | ||
| 86 | + | ||
| 87 | +// string string | ||
| 88 | +const char * const LABEL_INCOMING_STR( "Incoming Call" ); | ||
| 89 | +const char * const LABEL_NAME_STR( "Sam Smith" ); | ||
| 90 | +const char * const LABEL_NUMBER_STR( "+1 908-247-1695" ); | ||
| 91 | +const char * const LABEL_DECLINE_STR( "Decline Message" ); | ||
| 92 | +const char * const LABEL_TIME_STR( "1:03" ); | ||
| 93 | + | ||
| 94 | +// Set style from json | ||
| 95 | +const char * const BACKGROUND_STYLE_JSON( DEMO_STYLE_DIR "animated-gradient-call-active-style.json" ); | ||
| 96 | +const char * const BACKGROUND_INCOME_STYLE_STR( "IncomeBackground" ); | ||
| 97 | +const char * const BACKGROUND_ACTIVE_STYLE_STR( "ActiveBackground" ); | ||
| 98 | +const char * const DECLINE_BUTTON_STYLE_STR( "DeclineButton" ); | ||
| 99 | + | ||
| 100 | +} // unnamed namespace | ||
| 101 | + | ||
| 102 | +// This example shows how to render animated gradients | ||
| 103 | +// | ||
| 104 | +class CallController : public ConnectionTracker | ||
| 105 | +{ | ||
| 106 | +public: | ||
| 107 | + CallController(Application& application) | ||
| 108 | + : mApplication( application ), | ||
| 109 | + mColorStart( 0.0f, 0.0f, 0.0f, 0.0f ), | ||
| 110 | + mColorEnd( 0.0f, 0.0f, 0.0f, 0.0f ), | ||
| 111 | + mColorReduce( 0.0f, 0.0f, 0.0f, 0.0f ), | ||
| 112 | + mButtonColorStart( 0.0f, 0.0f, 0.0f, 0.0f ), | ||
| 113 | + mButtonColorEnd( 0.0f, 0.0f, 0.0f, 0.0f ), | ||
| 114 | + mDuration( 0.0f ), | ||
| 115 | + mBackgroundDurationIncoming( 0.0f ), | ||
| 116 | + mBackgroundDurationActive( 0.0f ), | ||
| 117 | + mButtonDuration( 0.0f ), | ||
| 118 | + mButtonDelay( 0.0f ) | ||
| 119 | + { | ||
| 120 | + // Connect to the Application's Init signal | ||
| 121 | + mApplication.InitSignal().Connect( this, &CallController::Create ); | ||
| 122 | + } | ||
| 123 | + | ||
| 124 | + ~CallController() | ||
| 125 | + { | ||
| 126 | + // Nothing to do here; | ||
| 127 | + } | ||
| 128 | + | ||
| 129 | + // The Init signal is received once (only) during the Application lifetime | ||
| 130 | + void Create(Application& application) | ||
| 131 | + { | ||
| 132 | + // Get a handle to the stage | ||
| 133 | + mStage = Stage::GetCurrent(); | ||
| 134 | + mStage.KeyEventSignal().Connect( this, &CallController::OnKeyEvent ); | ||
| 135 | + | ||
| 136 | + // Apply custom style for background and button. | ||
| 137 | + StyleManager::Get().ApplyTheme( BACKGROUND_STYLE_JSON ); | ||
| 138 | + | ||
| 139 | + // Get current device's width and height. | ||
| 140 | + STAGE_SIZE = mStage.GetSize(); | ||
| 141 | + SCALED_STAGE_SIZE = STAGE_SIZE / 360.0f; | ||
| 142 | + SCALED_STAGE_SIZE_3 = Vector3( SCALED_STAGE_SIZE.x, SCALED_STAGE_SIZE.y, 0.0f ); | ||
| 143 | + SCALED_WIDTH = SCALED_STAGE_SIZE.x < SCALED_STAGE_SIZE.y ? SCALED_STAGE_SIZE.x : SCALED_STAGE_SIZE.y; | ||
| 144 | + SCALED_HEIGHT = SCALED_WIDTH; | ||
| 145 | + | ||
| 146 | + // Note that this is heuristic value | ||
| 147 | + FONT_SCALE = 0.25f * STAGE_SIZE.y / STAGE_SIZE.x; | ||
| 148 | + | ||
| 149 | + mBackground = Control::New(); | ||
| 150 | + mBackground.SetParentOrigin( ParentOrigin::CENTER ); | ||
| 151 | + mBackground.SetAnchorPoint( AnchorPoint::CENTER ); | ||
| 152 | + mBackground.SetSize( STAGE_SIZE ); | ||
| 153 | + | ||
| 154 | + mStage.Add( mBackground ); | ||
| 155 | + | ||
| 156 | + BuildParameter(); | ||
| 157 | + SetupActors(); | ||
| 158 | + SetupAnimation(); | ||
| 159 | + | ||
| 160 | + Reset(); | ||
| 161 | + } | ||
| 162 | + | ||
| 163 | + void OnKeyEvent(const KeyEvent& event) | ||
| 164 | + { | ||
| 165 | + if( event.state == KeyEvent::Down ) | ||
| 166 | + { | ||
| 167 | + if( IsKey( event, Dali::DALI_KEY_ESCAPE ) || IsKey( event, Dali::DALI_KEY_BACK ) ) | ||
| 168 | + { | ||
| 169 | + mApplication.Quit(); | ||
| 170 | + } | ||
| 171 | + } | ||
| 172 | + } | ||
| 173 | + | ||
| 174 | +private: | ||
| 175 | + | ||
| 176 | + // Setup const parameter values | ||
| 177 | + void BuildParameter() | ||
| 178 | + { | ||
| 179 | + mDuration = CHANGE_DURATION; | ||
| 180 | + } | ||
| 181 | + | ||
| 182 | + void SetupActors() | ||
| 183 | + { | ||
| 184 | + SetupComingActors(); | ||
| 185 | + SetupActiveActors(); | ||
| 186 | + } | ||
| 187 | + | ||
| 188 | + // Create and Add to stage when visible at call incomming | ||
| 189 | + void SetupComingActors() | ||
| 190 | + { | ||
| 191 | + mButtonIconDecall = ImageView::New(); | ||
| 192 | + mButtonIconDecall.SetImage( ICON_DECALL_IMAGE ); | ||
| 193 | + mButtonIconDecall.SetParentOrigin( ParentOrigin::CENTER ); | ||
| 194 | + mButtonIconDecall.SetAnchorPoint( AnchorPoint::CENTER ); | ||
| 195 | + mButtonIconDecall.SetSize( ICON_DECALL_SIZE * SCALED_WIDTH ); | ||
| 196 | + mButtonIconDecall.SetPosition( ICON_DECALL_POSITION * SCALED_WIDTH ); | ||
| 197 | + | ||
| 198 | + mButtonIconBattery = ImageView::New(); | ||
| 199 | + mButtonIconBattery.SetImage( ICON_BATTERY_IMAGE ); | ||
| 200 | + mButtonIconBattery.SetParentOrigin( ParentOrigin::TOP_CENTER ); | ||
| 201 | + mButtonIconBattery.SetAnchorPoint( AnchorPoint::TOP_CENTER ); | ||
| 202 | + mButtonIconBattery.SetSize( ICON_BATTERY_SIZE * SCALED_WIDTH ); | ||
| 203 | + mButtonIconBattery.SetPosition( ICON_BATTERY_POSITION * SCALED_WIDTH ); | ||
| 204 | + | ||
| 205 | + mCallStartButton = PushButton::New(); | ||
| 206 | + mCallStartButton.SetParentOrigin( ParentOrigin::CENTER ); | ||
| 207 | + mCallStartButton.SetAnchorPoint( AnchorPoint::CENTER ); | ||
| 208 | + mCallStartButton.SetSize( BUTTON_CALL_START_SIZE * SCALED_WIDTH ); | ||
| 209 | + mCallStartButton.SetPosition( BUTTON_CALL_START_POSITION * SCALED_WIDTH ); | ||
| 210 | + mCallStartButton.ClickedSignal().Connect( this, &CallController::OnButtonClicked ); | ||
| 211 | + mCallStartButton.SetProperty( Button::Property::SELECTED_STATE_IMAGE, ICON_CALL_IMAGE ); | ||
| 212 | + mCallStartButton.SetProperty( Button::Property::UNSELECTED_STATE_IMAGE, ICON_CALL_IMAGE ); | ||
| 213 | + | ||
| 214 | + mStage.Add( mCallStartButton ); | ||
| 215 | + mStage.Add( mButtonIconDecall ); | ||
| 216 | + mStage.Add( mButtonIconBattery ); | ||
| 217 | + | ||
| 218 | + mLabelIncoming = TextLabel::New( LABEL_INCOMING_STR ); | ||
| 219 | + mLabelIncoming.SetParentOrigin( ParentOrigin::CENTER ); | ||
| 220 | + mLabelIncoming.SetAnchorPoint( AnchorPoint::CENTER ); | ||
| 221 | + mLabelIncoming.SetSize( LABEL_INCOMING_SIZE * SCALED_STAGE_SIZE ); | ||
| 222 | + mLabelIncoming.SetPosition( LABEL_INCOMING_POSITION * SCALED_STAGE_SIZE_3 ); | ||
| 223 | + mLabelIncoming.SetVisible( true ); | ||
| 224 | + mLabelIncoming.SetProperty( TextLabel::Property::TEXT_COLOR, LABEL_INCOMING_FONT_COLOR ); | ||
| 225 | + mLabelIncoming.SetProperty( TextLabel::Property::POINT_SIZE, LABEL_INCOMING_FONT_SIZE * FONT_SCALE ); | ||
| 226 | + mLabelIncoming.SetProperty( TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" ); | ||
| 227 | + mLabelIncoming.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); | ||
| 228 | + | ||
| 229 | + mLabelName = TextLabel::New( LABEL_NAME_STR ); | ||
| 230 | + mLabelName.SetParentOrigin( ParentOrigin::CENTER ); | ||
| 231 | + mLabelName.SetAnchorPoint( AnchorPoint::CENTER ); | ||
| 232 | + mLabelName.SetSize( LABEL_NAME_SIZE * SCALED_STAGE_SIZE ); | ||
| 233 | + mLabelName.SetPosition( LABEL_NAME_POSITION * SCALED_STAGE_SIZE_3 ); | ||
| 234 | + mLabelName.SetVisible( true ); | ||
| 235 | + mLabelName.SetProperty( TextLabel::Property::TEXT_COLOR, LABEL_NAME_FONT_COLOR ); | ||
| 236 | + mLabelName.SetProperty( TextLabel::Property::POINT_SIZE, LABEL_NAME_FONT_SIZE * FONT_SCALE ); | ||
| 237 | + mLabelName.SetProperty( TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" ); | ||
| 238 | + mLabelName.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); | ||
| 239 | + | ||
| 240 | + mLabelNumber = TextLabel::New( LABEL_NUMBER_STR ); | ||
| 241 | + mLabelNumber.SetParentOrigin( ParentOrigin::CENTER ); | ||
| 242 | + mLabelNumber.SetAnchorPoint( AnchorPoint::CENTER ); | ||
| 243 | + mLabelNumber.SetSize( LABEL_NUMBER_SIZE * SCALED_STAGE_SIZE ); | ||
| 244 | + mLabelNumber.SetPosition( LABEL_NUMBER_POSITION * SCALED_STAGE_SIZE_3 ); | ||
| 245 | + mLabelNumber.SetVisible( true ); | ||
| 246 | + mLabelNumber.SetProperty( TextLabel::Property::TEXT_COLOR, LABEL_NUMBER_FONT_COLOR ); | ||
| 247 | + mLabelNumber.SetProperty( TextLabel::Property::POINT_SIZE, LABEL_NUMBER_FONT_SIZE * FONT_SCALE ); | ||
| 248 | + mLabelNumber.SetProperty( TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" ); | ||
| 249 | + mLabelNumber.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); | ||
| 250 | + | ||
| 251 | + mLabelDecline = TextLabel::New( LABEL_DECLINE_STR ); | ||
| 252 | + mLabelDecline.SetParentOrigin( ParentOrigin::BOTTOM_CENTER ); | ||
| 253 | + mLabelDecline.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER ); | ||
| 254 | + mLabelDecline.SetSize( LABEL_DECLINE_SIZE * SCALED_STAGE_SIZE ); | ||
| 255 | + mLabelDecline.SetPosition( LABEL_DECLINE_POSITION * SCALED_WIDTH ); | ||
| 256 | + mLabelDecline.SetVisible( true ); | ||
| 257 | + mLabelDecline.SetProperty( TextLabel::Property::TEXT_COLOR, LABEL_DECLINE_FONT_COLOR ); | ||
| 258 | + mLabelDecline.SetProperty( TextLabel::Property::POINT_SIZE, LABEL_DECLINE_FONT_SIZE * FONT_SCALE ); | ||
| 259 | + mLabelDecline.SetProperty( TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" ); | ||
| 260 | + mLabelDecline.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); | ||
| 261 | + | ||
| 262 | + mStage.Add( mLabelIncoming ); | ||
| 263 | + mStage.Add( mLabelName ); | ||
| 264 | + mStage.Add( mLabelNumber ); | ||
| 265 | + mStage.Add( mLabelDecline ); | ||
| 266 | + } | ||
| 267 | + | ||
| 268 | + // Create and Add to stage when visible at call active | ||
| 269 | + void SetupActiveActors() | ||
| 270 | + { | ||
| 271 | + mButtonClip = Control::New(); | ||
| 272 | + mButtonClip.SetParentOrigin( ParentOrigin::BOTTOM_CENTER ); | ||
| 273 | + mButtonClip.SetAnchorPoint( ParentOrigin::BOTTOM_CENTER ); | ||
| 274 | + mButtonClip.SetSize( BUTTON_DECALL_SIZE * SCALED_WIDTH ); | ||
| 275 | + mButtonClip.SetPosition( BUTTON_DECALL_CLIP_POSITION * SCALED_WIDTH ); | ||
| 276 | + | ||
| 277 | + mButtonIcon = ImageView::New(); | ||
| 278 | + mButtonIcon.SetImage( BUTTON_DECALL_ICON_IMAGE ); | ||
| 279 | + mButtonIcon.SetParentOrigin( ParentOrigin::CENTER ); | ||
| 280 | + mButtonIcon.SetAnchorPoint( AnchorPoint::CENTER ); | ||
| 281 | + mButtonIcon.SetSize( BUTTON_DECALL_ICON_SIZE * SCALED_WIDTH ); | ||
| 282 | + mButtonIcon.SetPosition( BUTTON_DECALL_ICON_POSITION * SCALED_WIDTH ); | ||
| 283 | + | ||
| 284 | + mCallEndButton = PushButton::New(); | ||
| 285 | + mCallEndButton.SetParentOrigin( ParentOrigin::CENTER ); | ||
| 286 | + mCallEndButton.SetAnchorPoint( AnchorPoint::CENTER ); | ||
| 287 | + mCallEndButton.SetSize( BUTTON_DECALL_SIZE * SCALED_WIDTH ); | ||
| 288 | + mCallEndButton.SetPosition( BUTTON_DECALL_POSITION * SCALED_WIDTH ); | ||
| 289 | + mCallEndButton.ClickedSignal().Connect( this, &CallController::OnButtonClicked ); | ||
| 290 | + mCallEndButton.SetProperty( Button::Property::SELECTED_STATE_IMAGE, "" ); | ||
| 291 | + mCallEndButton.SetProperty( Button::Property::UNSELECTED_STATE_IMAGE, "" ); | ||
| 292 | + mCallEndButton.SetStyleName( DECLINE_BUTTON_STYLE_STR ); | ||
| 293 | + | ||
| 294 | + mButtonClip.Add( mCallEndButton ); | ||
| 295 | + mButtonClip.Add( mButtonIcon ); | ||
| 296 | + | ||
| 297 | + mLabelTime = TextLabel::New( LABEL_TIME_STR ); | ||
| 298 | + mLabelTime.SetParentOrigin( ParentOrigin::CENTER ); | ||
| 299 | + mLabelTime.SetAnchorPoint( AnchorPoint::CENTER ); | ||
| 300 | + mLabelTime.SetSize( LABEL_TIME_SIZE * SCALED_STAGE_SIZE ); | ||
| 301 | + mLabelTime.SetPosition( LABEL_TIME_POSITION * SCALED_STAGE_SIZE_3 ); | ||
| 302 | + mLabelTime.SetVisible( false ); | ||
| 303 | + mLabelTime.SetProperty( TextLabel::Property::TEXT_COLOR, LABEL_TIME_FONT_COLOR ); | ||
| 304 | + mLabelTime.SetProperty( TextLabel::Property::POINT_SIZE, LABEL_TIME_FONT_SIZE * FONT_SCALE ); | ||
| 305 | + mLabelTime.SetProperty( TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" ); | ||
| 306 | + mLabelTime.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); | ||
| 307 | + | ||
| 308 | + mStage.Add( mLabelTime ); | ||
| 309 | + } | ||
| 310 | + | ||
| 311 | + void SetupAnimation() | ||
| 312 | + { | ||
| 313 | + mMoveFront = Animation::New( mDuration ); | ||
| 314 | + mMoveBack = Animation::New( mDuration ); | ||
| 315 | + | ||
| 316 | + mMoveFront.AnimateTo( Property( mButtonClip, Actor::Property::POSITION_Y ), 0.0f * SCALED_HEIGHT ); | ||
| 317 | + mMoveBack.AnimateTo( Property( mButtonClip, Actor::Property::POSITION_Y ), BUTTON_DECALL_CLIP_POSITION.y * SCALED_HEIGHT ); | ||
| 318 | + | ||
| 319 | + mMoveFront.AnimateTo( Property( mCallStartButton, Actor::Property::VISIBLE ), false ); | ||
| 320 | + mMoveFront.AnimateTo( Property( mButtonIconDecall, Actor::Property::VISIBLE ), false ); | ||
| 321 | + mMoveBack.AnimateTo( Property( mCallStartButton, Actor::Property::VISIBLE ), true ); | ||
| 322 | + mMoveBack.AnimateTo( Property( mButtonIconDecall, Actor::Property::VISIBLE ), true ); | ||
| 323 | + | ||
| 324 | + mMoveFront.AnimateTo( Property( mLabelIncoming, Actor::Property::VISIBLE ), false ); | ||
| 325 | + mMoveFront.AnimateTo( Property( mLabelNumber, Actor::Property::VISIBLE ), false ); | ||
| 326 | + mMoveFront.AnimateTo( Property( mLabelTime, Actor::Property::VISIBLE ), true ); | ||
| 327 | + mMoveBack.AnimateTo( Property( mLabelIncoming, Actor::Property::VISIBLE ), true ); | ||
| 328 | + mMoveBack.AnimateTo( Property( mLabelNumber, Actor::Property::VISIBLE ), true ); | ||
| 329 | + mMoveBack.AnimateTo( Property( mLabelTime, Actor::Property::VISIBLE ), false ); | ||
| 330 | + } | ||
| 331 | + | ||
| 332 | + bool OnButtonClicked(Button button) | ||
| 333 | + { | ||
| 334 | + if( button == mCallStartButton ) | ||
| 335 | + { | ||
| 336 | + mBackground.SetStyleName( BACKGROUND_ACTIVE_STYLE_STR ); | ||
| 337 | + mStage.Add( mButtonClip ); | ||
| 338 | + mMoveFront.Play(); | ||
| 339 | + } | ||
| 340 | + else if( button == mCallEndButton ) | ||
| 341 | + { | ||
| 342 | + mBackground.SetStyleName( BACKGROUND_INCOME_STYLE_STR ); | ||
| 343 | + mTempTimer = Timer::New( mDuration * 1000.0f ); | ||
| 344 | + mTempTimer.TickSignal().Connect( this, &CallController::smallTick ); | ||
| 345 | + mTempTimer.Start(); | ||
| 346 | + mMoveBack.Play(); | ||
| 347 | + } | ||
| 348 | + return true; | ||
| 349 | + } | ||
| 350 | + bool smallTick() | ||
| 351 | + { | ||
| 352 | + mButtonClip.Unparent(); | ||
| 353 | + return false; | ||
| 354 | + } | ||
| 355 | + | ||
| 356 | + void Reset() | ||
| 357 | + { | ||
| 358 | + mBackground.SetStyleName( BACKGROUND_INCOME_STYLE_STR ); | ||
| 359 | + } | ||
| 360 | + | ||
| 361 | +private: | ||
| 362 | + Application& mApplication; | ||
| 363 | + Stage mStage; | ||
| 364 | + | ||
| 365 | + Control mBackground; | ||
| 366 | + | ||
| 367 | + // Show when call incommint | ||
| 368 | + PushButton mCallStartButton; | ||
| 369 | + ImageView mButtonIconDecall; | ||
| 370 | + ImageView mButtonIconBattery; | ||
| 371 | + TextLabel mLabelIncoming; | ||
| 372 | + TextLabel mLabelName; | ||
| 373 | + TextLabel mLabelNumber; | ||
| 374 | + TextLabel mLabelDecline; | ||
| 375 | + | ||
| 376 | + // Show when call active | ||
| 377 | + PushButton mCallEndButton; | ||
| 378 | + ImageView mButtonIcon; | ||
| 379 | + Control mButtonBackground; | ||
| 380 | + Control mButtonClip; | ||
| 381 | + TextLabel mLabelTime; | ||
| 382 | + | ||
| 383 | + Timer mTempTimer; | ||
| 384 | + | ||
| 385 | + Animation mMoveFront; | ||
| 386 | + Animation mMoveBack; | ||
| 387 | + | ||
| 388 | + Vector4 mColorStart; | ||
| 389 | + Vector4 mColorEnd; | ||
| 390 | + Vector4 mColorReduce; | ||
| 391 | + | ||
| 392 | + Vector4 mButtonColorStart; | ||
| 393 | + Vector4 mButtonColorEnd; | ||
| 394 | + | ||
| 395 | + float mDuration; | ||
| 396 | + float mBackgroundDurationIncoming; | ||
| 397 | + float mBackgroundDurationActive; | ||
| 398 | + float mButtonDuration; | ||
| 399 | + float mButtonDelay; | ||
| 400 | +}; | ||
| 401 | + | ||
| 402 | +int main(int argc, char **argv) | ||
| 403 | +{ | ||
| 404 | + Application application = Application::New( &argc, &argv ); | ||
| 405 | + | ||
| 406 | + CallController test( application ); | ||
| 407 | + | ||
| 408 | + application.MainLoop(); | ||
| 409 | + return 0; | ||
| 410 | +} |
examples/animated-gradient-card-active/animated-gradient-card-active.cpp
0 → 100644
| 1 | +/* | ||
| 2 | +* Copyright (c) 2017 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 | +#include <dali/dali.h> | ||
| 18 | +#include <dali-toolkit/dali-toolkit.h> | ||
| 19 | +#include <iostream> | ||
| 20 | +#include <dali-toolkit/devel-api/visuals/animated-gradient-visual-properties-devel.h> | ||
| 21 | +#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h> | ||
| 22 | +#include <dali/integration-api/debug.h> | ||
| 23 | + | ||
| 24 | +using namespace Dali; | ||
| 25 | +using namespace Dali::Toolkit; | ||
| 26 | + | ||
| 27 | +// This example shows how to create and display animated-gradient-effect | ||
| 28 | +// | ||
| 29 | +namespace | ||
| 30 | +{ | ||
| 31 | +// The value for scale-change between wearable-mobile | ||
| 32 | +// Can be changed on App-Create time | ||
| 33 | +Vector2 STAGE_SIZE = Vector2( 360.0f, 360.0f ); | ||
| 34 | +Vector2 SCALED_STAGE_SIZE = Vector2( 1.0f, 1.0f ); | ||
| 35 | +Vector3 SCALED_STAGE_SIZE_3 = Vector3( 1.0f, 1.0f, 0.0f ); | ||
| 36 | +float SCALED_WIDTH = 1.0f; | ||
| 37 | +float SCALED_HEIGHT = 1.0f; | ||
| 38 | +float FONT_SCALE = 0.25f; | ||
| 39 | + | ||
| 40 | +// const parameters for color and animation | ||
| 41 | +const float CHANGE_DURATION = 0.2f; | ||
| 42 | +const float CARD_MOVE_DURATION = 1.0f; | ||
| 43 | +const float LOADING_ONE_CYCLE_DURATION = 2.0f; | ||
| 44 | +const int LOADING_CYCLE_CNT = 4; | ||
| 45 | +const int LOADING_CYCLE_DT = 10; | ||
| 46 | +const Vector4 DEFAULT_COLOR = Vector4( 0.5f, 0.5f, 0.5f, 1.0f ); | ||
| 47 | + | ||
| 48 | +const float PSEUDO_SCROLL_TIME = 100.0f; | ||
| 49 | +const float PSEUDO_SCROLL_OFFSET = 0.05f; | ||
| 50 | + | ||
| 51 | +// const static parameters for cards when resolution is 360x360 | ||
| 52 | +const int CARD_NUM = 3; | ||
| 53 | +const Vector2 CARD_SIZE = Vector2( 210.0f, 143.0f ); | ||
| 54 | +const Vector2 CARD_OFFSET = Vector2( 0.0f, 12.5f ); | ||
| 55 | +const Vector2 CARD_DIFF = Vector2( 240.0f, 0.0f ); | ||
| 56 | +const float CARD_BOUNCE_ANIMATION_RATE = 0.3f; | ||
| 57 | + | ||
| 58 | +const Vector2 CARD_SIZE_BIG = Vector2( 292.0f, 199.0f ); | ||
| 59 | +const Vector2 CARD_BIG_OFFSET = Vector2( 0.0f, -5.5f ); | ||
| 60 | +const float CARD_MOVE_DIST = 40.0f; | ||
| 61 | + | ||
| 62 | +// const private parameters for each cards | ||
| 63 | +const Vector4 CARD_COLOR_START_LIST[] = | ||
| 64 | +{ | ||
| 65 | + Vector4( 0x24, 0x2C, 0x93, 255.f ) / 255.f, | ||
| 66 | + Vector4( 0x7A, 0x1C, 0x9E, 255.f ) / 255.f, | ||
| 67 | + Vector4( 0xA9, 0x0C, 0x96, 255.f ) / 255.f, | ||
| 68 | +}; | ||
| 69 | +const Vector4 CARD_COLOR_END_LIST[] = | ||
| 70 | +{ | ||
| 71 | + Vector4( 0x04, 0x13, 0x23, 255.f ) / 255.f, | ||
| 72 | + Vector4( 0x28, 0x01, 0x45, 255.f ) / 255.f, | ||
| 73 | + Vector4( 0x37, 0x0A, 0x2E, 255.f ) / 255.f, | ||
| 74 | +}; | ||
| 75 | +const Vector4 CARD_COLOR_BACKGROUND_LIST[] = | ||
| 76 | +{ | ||
| 77 | + Vector4( 0x28, 0x2B, 0x6E, 255.f ) / 255.f, | ||
| 78 | + Vector4( 0x4D, 0x15, 0x61, 255.f ) / 255.f, | ||
| 79 | + Vector4( 0x70, 0x21, 0x61, 255.f ) / 255.f, | ||
| 80 | +}; | ||
| 81 | +const char * const CARD_IMAGE_LIST[] = | ||
| 82 | +{ | ||
| 83 | + ( DEMO_IMAGE_DIR "Card_01.png" ), | ||
| 84 | + ( DEMO_IMAGE_DIR "Card_02.png" ), | ||
| 85 | + ( DEMO_IMAGE_DIR "Card_03.png" ), | ||
| 86 | +}; | ||
| 87 | + | ||
| 88 | +// const parameters for add button position and size when resolution is 360x360x | ||
| 89 | +const Vector2 BUTTON_ADD_SIZE = Vector2( 292.0f, 52.0f ); | ||
| 90 | +const Vector3 BUTTON_ADD_POSITION = Vector3( 0.0f, 0.0f, 0.0f ); | ||
| 91 | +const char * const BUTTON_ADD_IMAGE( DEMO_IMAGE_DIR "Card_Add_Button.png" ); | ||
| 92 | + | ||
| 93 | +// const parameters for string position and size and font-size when resolution is 360x360 | ||
| 94 | +const Vector2 LABEL_TICKET_SIZE = Vector2( 148.0f, 31.0f ); | ||
| 95 | +const Vector3 LABEL_TICKET_POSITION = Vector3( 0.0f, 72.5f, 0.0f ); | ||
| 96 | +const Vector4 LABEL_TICKET_FONT_COLOR = Vector4( 0.98f, 0.98f, 0.98f, 1.0f ); | ||
| 97 | +const float LABEL_TICKET_FONT_SIZE = 25.0f; | ||
| 98 | +const Vector2 LABEL_HOLD_SIZE = Vector2( 180.0f, 60.0f ); | ||
| 99 | +const Vector3 LABEL_HOLD_POSITION = Vector3( 1.0f, 103.0f, 0.0f ); | ||
| 100 | +const Vector4 LABEL_HOLD_FONT_COLOR = Vector4( 0.98f, 0.98f, 0.98f, 1.0f ); | ||
| 101 | +const float LABEL_HOLD_FONT_SIZE = 25.0f; | ||
| 102 | +const Vector2 LABEL_TERMINAL_SIZE = Vector2( 180.0f, 60.0f ); | ||
| 103 | +const Vector3 LABEL_TERMINAL_POSITION = Vector3( 1.0f, 133.0f, 0.0f ); | ||
| 104 | +const Vector4 LABEL_TERMINAL_FONT_COLOR = Vector4( 0.98f, 0.98f, 0.98f, 1.0f ); | ||
| 105 | +const float LABEL_TERMINAL_FONT_SIZE = 25.0f; | ||
| 106 | + | ||
| 107 | +// string string | ||
| 108 | +const char * const LABEL_TICKET_STR( "Select Ticket" ); | ||
| 109 | +const char * const LABEL_HOLD_STR( "Hold near" ); | ||
| 110 | +const char * const LABEL_TERMINAL_STR( "terminal" ); | ||
| 111 | + | ||
| 112 | +class CardManager | ||
| 113 | +{ | ||
| 114 | +public: | ||
| 115 | + CardManager() | ||
| 116 | + : mSize( 0.0f, 0.0f ), | ||
| 117 | + mOffset( 0.0f, 0.0f), | ||
| 118 | + mDiff( 0.0f, 0.0f), | ||
| 119 | + mCurIndex( 0 ), | ||
| 120 | + mCurState( 0 ) | ||
| 121 | + { | ||
| 122 | + } | ||
| 123 | + ~CardManager() {} | ||
| 124 | + | ||
| 125 | + void Init(Stage& stage) | ||
| 126 | + { | ||
| 127 | + mSize = CARD_SIZE * SCALED_WIDTH; | ||
| 128 | + mOffset = CARD_OFFSET * SCALED_WIDTH; | ||
| 129 | + mDiff = CARD_DIFF * SCALED_WIDTH; | ||
| 130 | + | ||
| 131 | + mCurIndex = 0; | ||
| 132 | + mCurState = 0; | ||
| 133 | + | ||
| 134 | + for( int k = 0; k < CARD_NUM; k++ ) | ||
| 135 | + { | ||
| 136 | + mPosition[k] = mOffset + mDiff * k; | ||
| 137 | + | ||
| 138 | + mColorStart[k] = CARD_COLOR_START_LIST[k]; | ||
| 139 | + mColorEnd[k] = CARD_COLOR_END_LIST[k]; | ||
| 140 | + mColorBackground[k] = CARD_COLOR_BACKGROUND_LIST[k]; | ||
| 141 | + | ||
| 142 | + mImageUrl[k] = CARD_IMAGE_LIST[k]; | ||
| 143 | + | ||
| 144 | + mCard[k] = ImageView::New(); | ||
| 145 | + mCard[k].SetImage( mImageUrl[k] ); | ||
| 146 | + mCard[k].SetParentOrigin( ParentOrigin::CENTER ); | ||
| 147 | + mCard[k].SetAnchorPoint( AnchorPoint::CENTER ); | ||
| 148 | + mCard[k].SetSize( mSize.x, mSize.y ); | ||
| 149 | + mCard[k].SetPosition( mPosition[k].x, mPosition[k].y ); | ||
| 150 | + | ||
| 151 | + stage.Add( mCard[k] ); | ||
| 152 | + } | ||
| 153 | + } | ||
| 154 | + | ||
| 155 | + bool MoveRight(float duration) | ||
| 156 | + { | ||
| 157 | + Animation anim = Animation::New( duration ); | ||
| 158 | + for( int k = 0; k < CARD_NUM; k++ ) | ||
| 159 | + { | ||
| 160 | + if( mCurIndex == 0 ) | ||
| 161 | + { | ||
| 162 | + anim.AnimateBy( Property( mCard[k], Actor::Property::POSITION_X ), mDiff.x * CARD_BOUNCE_ANIMATION_RATE, AlphaFunction::BOUNCE ); | ||
| 163 | + } | ||
| 164 | + else | ||
| 165 | + { | ||
| 166 | + anim.AnimateBy( Property( mCard[k], Actor::Property::POSITION_X ), mDiff.x, AlphaFunction::EASE_OUT ); | ||
| 167 | + } | ||
| 168 | + } | ||
| 169 | + bool res = false; | ||
| 170 | + if( mCurIndex != 0 ) | ||
| 171 | + { | ||
| 172 | + mCurIndex = (mCurIndex - 1) % CARD_NUM; | ||
| 173 | + res = true; | ||
| 174 | + } | ||
| 175 | + anim.Play(); | ||
| 176 | + return res; | ||
| 177 | + } | ||
| 178 | + | ||
| 179 | + bool MoveLeft(float duration) | ||
| 180 | + { | ||
| 181 | + Animation anim = Animation::New( duration ); | ||
| 182 | + for( int k = 0; k < CARD_NUM; k++ ) | ||
| 183 | + { | ||
| 184 | + if( mCurIndex == CARD_NUM - 1 ) | ||
| 185 | + { | ||
| 186 | + anim.AnimateBy( Property( mCard[k], Actor::Property::POSITION_X ), -mDiff.x * CARD_BOUNCE_ANIMATION_RATE, AlphaFunction::BOUNCE ); | ||
| 187 | + } | ||
| 188 | + else | ||
| 189 | + { | ||
| 190 | + anim.AnimateBy( Property( mCard[k], Actor::Property::POSITION_X ), -mDiff.x, AlphaFunction::EASE_OUT ); | ||
| 191 | + } | ||
| 192 | + } | ||
| 193 | + bool res = false; | ||
| 194 | + if( mCurIndex != CARD_NUM - 1 ) | ||
| 195 | + { | ||
| 196 | + mCurIndex = (mCurIndex + 1) % CARD_NUM; | ||
| 197 | + res = true; | ||
| 198 | + } | ||
| 199 | + anim.Play(); | ||
| 200 | + return res; | ||
| 201 | + } | ||
| 202 | + | ||
| 203 | + Vector4 GetColorStart(int index) | ||
| 204 | + { | ||
| 205 | + DALI_ASSERT_ALWAYS( index >= 0 && index < CARD_NUM ); | ||
| 206 | + return mColorStart[index]; | ||
| 207 | + } | ||
| 208 | + | ||
| 209 | + Vector4 GetColorEnd(int index) | ||
| 210 | + { | ||
| 211 | + DALI_ASSERT_ALWAYS( index >= 0 && index < CARD_NUM ); | ||
| 212 | + return mColorEnd[index]; | ||
| 213 | + } | ||
| 214 | + | ||
| 215 | + Vector4 GetColorBackground(int index) | ||
| 216 | + { | ||
| 217 | + DALI_ASSERT_ALWAYS( index >= 0 && index < CARD_NUM ); | ||
| 218 | + return mColorBackground[index]; | ||
| 219 | + } | ||
| 220 | + | ||
| 221 | + ImageView& operator [](int index) | ||
| 222 | + { | ||
| 223 | + DALI_ASSERT_ALWAYS( index >= 0 && index < CARD_NUM ); | ||
| 224 | + return mCard[index]; | ||
| 225 | + } | ||
| 226 | + | ||
| 227 | + ImageView mCard[CARD_NUM]; | ||
| 228 | + std::string mImageUrl[CARD_NUM]; | ||
| 229 | + Vector4 mColorStart[CARD_NUM]; | ||
| 230 | + Vector4 mColorEnd[CARD_NUM]; | ||
| 231 | + Vector4 mColorBackground[CARD_NUM]; | ||
| 232 | + Vector2 mPosition[CARD_NUM]; | ||
| 233 | + Vector2 mSize; | ||
| 234 | + Vector2 mOffset; | ||
| 235 | + Vector2 mDiff; | ||
| 236 | + int mCurIndex; | ||
| 237 | + int mCurState; | ||
| 238 | +}; | ||
| 239 | + | ||
| 240 | +} // unnamed namespace | ||
| 241 | + | ||
| 242 | +// This example shows how to render animated gradients | ||
| 243 | +// | ||
| 244 | +class CardController : public ConnectionTracker | ||
| 245 | +{ | ||
| 246 | +public: | ||
| 247 | + CardController(Application& application) | ||
| 248 | + : mApplication( application ), | ||
| 249 | + mNormalColor( 0.0f, 0.0f, 0.0f, 0.0f ), | ||
| 250 | + mNormalStartColor( 0.0f, 0.0f, 0.0f, 0.0f ), | ||
| 251 | + mNormalEndColor( 0.0f, 0.0f, 0.0f, 0.0f), | ||
| 252 | + mFirstTouchPos( 0.0f, 0.0f ), | ||
| 253 | + mLastTouchPos( 0.0f, 0.0f ), | ||
| 254 | + mCardDuration( 0.0f ), | ||
| 255 | + mDuration( 0.0f ), | ||
| 256 | + mLoadingTime( 0.0f ), | ||
| 257 | + mLoadingCount( 0 ), | ||
| 258 | + mLoadingCountScale( 0 ), | ||
| 259 | + mTickCount( 0 ), | ||
| 260 | + mCancelSignal( false ), | ||
| 261 | + mIsTouchedActor( false ) | ||
| 262 | + { | ||
| 263 | + // Connect to the Application's Init signal | ||
| 264 | + mApplication.InitSignal().Connect( this, &CardController::Create ); | ||
| 265 | + } | ||
| 266 | + | ||
| 267 | + ~CardController() | ||
| 268 | + { | ||
| 269 | + // Nothing to do here; | ||
| 270 | + } | ||
| 271 | + | ||
| 272 | + // The Init signal is received once (only) during the Application lifetime | ||
| 273 | + void Create(Application& application) | ||
| 274 | + { | ||
| 275 | + // Get a handle to the stage | ||
| 276 | + mStage = Stage::GetCurrent(); | ||
| 277 | + mStage.KeyEventSignal().Connect( this, &CardController::OnKeyEvent ); | ||
| 278 | + | ||
| 279 | + // Get current device's width and height. | ||
| 280 | + STAGE_SIZE = mStage.GetSize(); | ||
| 281 | + SCALED_STAGE_SIZE = STAGE_SIZE / 360.0f; | ||
| 282 | + SCALED_STAGE_SIZE_3 = Vector3( SCALED_STAGE_SIZE.x, SCALED_STAGE_SIZE.y, 0.0f ); | ||
| 283 | + SCALED_WIDTH = SCALED_STAGE_SIZE.x < SCALED_STAGE_SIZE.y ? SCALED_STAGE_SIZE.x : SCALED_STAGE_SIZE.y; | ||
| 284 | + SCALED_HEIGHT = SCALED_WIDTH; | ||
| 285 | + | ||
| 286 | + // Note that this is heuristic value | ||
| 287 | + FONT_SCALE = 0.25f * STAGE_SIZE.y / STAGE_SIZE.x; | ||
| 288 | + | ||
| 289 | + mBackground = Control::New(); | ||
| 290 | + mBackground.SetParentOrigin( ParentOrigin::CENTER ); | ||
| 291 | + mBackground.SetAnchorPoint( AnchorPoint::CENTER ); | ||
| 292 | + mBackground.SetSize( STAGE_SIZE ); | ||
| 293 | + | ||
| 294 | + mStage.Add( mBackground ); | ||
| 295 | + | ||
| 296 | + BuildParameter(); | ||
| 297 | + InitMap(); | ||
| 298 | + SetupCards(); | ||
| 299 | + SetupActors(); | ||
| 300 | + SetupAnimation(); | ||
| 301 | + | ||
| 302 | + mStage.GetRootLayer().TouchSignal().Connect( this, &CardController::OnTouchLayer ); | ||
| 303 | + Reset(); | ||
| 304 | + } | ||
| 305 | + | ||
| 306 | + bool OnTouchCards(Actor actor, const TouchData &data) | ||
| 307 | + { | ||
| 308 | + if( data.GetPointCount() > 0 ) | ||
| 309 | + { | ||
| 310 | + if( data.GetState( 0 ) == PointState::DOWN ) | ||
| 311 | + { | ||
| 312 | + if( mCards.mCurState == 0 ) | ||
| 313 | + { | ||
| 314 | + mIsTouchedActor = false; | ||
| 315 | + if( mCards[mCards.mCurIndex] == actor ) | ||
| 316 | + { | ||
| 317 | + mIsTouchedActor = true; | ||
| 318 | + } | ||
| 319 | + mCards.mCurState = 3; | ||
| 320 | + mTempTimer = Timer::New( PSEUDO_SCROLL_TIME ); | ||
| 321 | + mTempTimer.TickSignal().Connect( this, &CardController::OnDetectMotionLayer ); | ||
| 322 | + mTempTimer.Start(); | ||
| 323 | + | ||
| 324 | + mFirstTouchPos = data.GetScreenPosition( 0 ); | ||
| 325 | + mLastTouchPos = mFirstTouchPos; | ||
| 326 | + } | ||
| 327 | + else if( mCards.mCurState == 1 ) | ||
| 328 | + { | ||
| 329 | + mCancelSignal = true; | ||
| 330 | + return false; | ||
| 331 | + } | ||
| 332 | + } | ||
| 333 | + else | ||
| 334 | + { | ||
| 335 | + mLastTouchPos = data.GetScreenPosition( 0 ); | ||
| 336 | + } | ||
| 337 | + } | ||
| 338 | + return true; | ||
| 339 | + } | ||
| 340 | + | ||
| 341 | + bool OnTouchLayer(Actor actor, const TouchData &data) | ||
| 342 | + { | ||
| 343 | + if( data.GetPointCount() > 0 ) | ||
| 344 | + { | ||
| 345 | + if( data.GetState( 0 ) == PointState::DOWN ) | ||
| 346 | + { | ||
| 347 | + if( mCards.mCurState == 0 ) | ||
| 348 | + { | ||
| 349 | + mIsTouchedActor = false; | ||
| 350 | + mCards.mCurState = 3; | ||
| 351 | + mTempTimer = Timer::New( PSEUDO_SCROLL_TIME ); | ||
| 352 | + mTempTimer.TickSignal().Connect( this, &CardController::OnDetectMotionLayer ); | ||
| 353 | + mTempTimer.Start(); | ||
| 354 | + | ||
| 355 | + mFirstTouchPos = data.GetScreenPosition( 0 ); | ||
| 356 | + mLastTouchPos = mFirstTouchPos; | ||
| 357 | + } | ||
| 358 | + } | ||
| 359 | + else | ||
| 360 | + { | ||
| 361 | + mLastTouchPos = data.GetScreenPosition( 0 ); | ||
| 362 | + } | ||
| 363 | + } | ||
| 364 | + return true; | ||
| 365 | + } | ||
| 366 | + | ||
| 367 | + // Heuristic Scroll View | ||
| 368 | + bool OnDetectMotionLayer() | ||
| 369 | + { | ||
| 370 | + if( mCards.mCurState == 3 ) | ||
| 371 | + { | ||
| 372 | + Vector2 diff = (mLastTouchPos - mFirstTouchPos); | ||
| 373 | + float offset = PSEUDO_SCROLL_OFFSET; | ||
| 374 | + // Scroll to right | ||
| 375 | + if( diff.x > mStage.GetSize().x * offset ) | ||
| 376 | + { | ||
| 377 | + mCards.mCurState = 2; | ||
| 378 | + MoveRight(); | ||
| 379 | + mCardChanger = Timer::New( mCardDuration * 1000.0f ); | ||
| 380 | + mCardChanger.TickSignal().Connect( this, &CardController::OnTickLayer ); | ||
| 381 | + mCardChanger.Start(); | ||
| 382 | + } | ||
| 383 | + // Scroll to left | ||
| 384 | + else if( diff.x < -mStage.GetSize().x * offset ) | ||
| 385 | + { | ||
| 386 | + mCards.mCurState = 2; | ||
| 387 | + MoveLeft(); | ||
| 388 | + mCardChanger = Timer::New( mCardDuration * 1000.0f ); | ||
| 389 | + mCardChanger.TickSignal().Connect( this, &CardController::OnTickLayer ); | ||
| 390 | + mCardChanger.Start(); | ||
| 391 | + } | ||
| 392 | + // Not a scroll input | ||
| 393 | + else | ||
| 394 | + { | ||
| 395 | + // Run NFC Tag effect if we touch a card | ||
| 396 | + if (mIsTouchedActor) | ||
| 397 | + { | ||
| 398 | + mCards.mCurState = 1; | ||
| 399 | + RunAnimation( mCards.mCurIndex ); | ||
| 400 | + } | ||
| 401 | + else | ||
| 402 | + { | ||
| 403 | + Reset(); | ||
| 404 | + } | ||
| 405 | + } | ||
| 406 | + } | ||
| 407 | + return false; | ||
| 408 | + } | ||
| 409 | + | ||
| 410 | + bool OnTickLayer() | ||
| 411 | + { | ||
| 412 | + Reset(); | ||
| 413 | + return false; | ||
| 414 | + } | ||
| 415 | + | ||
| 416 | + void OnKeyEvent(const KeyEvent& event) | ||
| 417 | + { | ||
| 418 | + if( event.state == KeyEvent::Down ) | ||
| 419 | + { | ||
| 420 | + if( IsKey( event, Dali::DALI_KEY_ESCAPE ) || IsKey( event, Dali::DALI_KEY_BACK ) ) | ||
| 421 | + { | ||
| 422 | + mApplication.Quit(); | ||
| 423 | + } | ||
| 424 | + } | ||
| 425 | + } | ||
| 426 | + | ||
| 427 | +private: | ||
| 428 | + | ||
| 429 | + // Utility function to make animation parameter map. return Property::Map | ||
| 430 | + Property::Value BuildMap(const Property::Value &start, const Property::Value &target, int dir, float duration, float delay, int repeat, float repeat_delay, int motion, int easing) | ||
| 431 | + { | ||
| 432 | + Property::Map map; | ||
| 433 | + | ||
| 434 | + map.Clear(); | ||
| 435 | + map.Insert( DevelAnimatedGradientVisual::AnimationParameter::Property::START, start ); | ||
| 436 | + map.Insert( DevelAnimatedGradientVisual::AnimationParameter::Property::TARGET, target ); | ||
| 437 | + if( dir == 0 ) | ||
| 438 | + { | ||
| 439 | + map.Insert( DevelAnimatedGradientVisual::AnimationParameter::Property::DIRECTION, DevelAnimatedGradientVisual::AnimationParameter::DirectionType::FORWARD ); | ||
| 440 | + } | ||
| 441 | + else | ||
| 442 | + { | ||
| 443 | + map.Insert( DevelAnimatedGradientVisual::AnimationParameter::Property::DIRECTION, DevelAnimatedGradientVisual::AnimationParameter::DirectionType::BACKWARD ); | ||
| 444 | + } | ||
| 445 | + map.Insert( DevelAnimatedGradientVisual::AnimationParameter::Property::DURATION, duration ); | ||
| 446 | + map.Insert( DevelAnimatedGradientVisual::AnimationParameter::Property::DELAY, delay ); | ||
| 447 | + map.Insert( DevelAnimatedGradientVisual::AnimationParameter::Property::REPEAT, repeat ); | ||
| 448 | + map.Insert( DevelAnimatedGradientVisual::AnimationParameter::Property::REPEAT_DELAY, repeat_delay ); | ||
| 449 | + if( motion == 0 ) | ||
| 450 | + { | ||
| 451 | + map.Insert( DevelAnimatedGradientVisual::AnimationParameter::Property::MOTION_TYPE, DevelAnimatedGradientVisual::AnimationParameter::MotionType::LOOP ); | ||
| 452 | + } | ||
| 453 | + else | ||
| 454 | + { | ||
| 455 | + map.Insert( DevelAnimatedGradientVisual::AnimationParameter::Property::MOTION_TYPE, DevelAnimatedGradientVisual::AnimationParameter::MotionType::MIRROR ); | ||
| 456 | + } | ||
| 457 | + if( easing == 0 ) | ||
| 458 | + { | ||
| 459 | + map.Insert( DevelAnimatedGradientVisual::AnimationParameter::Property::EASING_TYPE, DevelAnimatedGradientVisual::AnimationParameter::EasingType::LINEAR ); | ||
| 460 | + } | ||
| 461 | + else if( easing == 1 ) | ||
| 462 | + { | ||
| 463 | + map.Insert( DevelAnimatedGradientVisual::AnimationParameter::Property::EASING_TYPE, DevelAnimatedGradientVisual::AnimationParameter::EasingType::IN ); | ||
| 464 | + } | ||
| 465 | + else if( easing == 2 ) | ||
| 466 | + { | ||
| 467 | + map.Insert( DevelAnimatedGradientVisual::AnimationParameter::Property::EASING_TYPE, DevelAnimatedGradientVisual::AnimationParameter::EasingType::OUT ); | ||
| 468 | + } | ||
| 469 | + else | ||
| 470 | + { | ||
| 471 | + map.Insert( DevelAnimatedGradientVisual::AnimationParameter::Property::EASING_TYPE, DevelAnimatedGradientVisual::AnimationParameter::EasingType::IN_OUT ); | ||
| 472 | + } | ||
| 473 | + | ||
| 474 | + return Property::Value( map ); | ||
| 475 | + } | ||
| 476 | + | ||
| 477 | + // Setup background visual property during nothing action | ||
| 478 | + void InitMapNormal() | ||
| 479 | + { | ||
| 480 | + mBackgroundNormalMap.Clear(); | ||
| 481 | + mBackgroundNormalMap.Insert( Visual::Property::TYPE, DevelVisual::ANIMATED_GRADIENT ); | ||
| 482 | + | ||
| 483 | + mBackgroundNormalMap.Insert( Toolkit::DevelAnimatedGradientVisual::Property::START_POSITION, Vector2( -0.5, -0.5 ) ); | ||
| 484 | + mBackgroundNormalMap.Insert( Toolkit::DevelAnimatedGradientVisual::Property::END_POSITION, Vector2( 0.5, 0.5 ) ); | ||
| 485 | + mBackgroundNormalMap.Insert( Toolkit::DevelAnimatedGradientVisual::Property::START_COLOR, mNormalColor ); | ||
| 486 | + mBackgroundNormalMap.Insert( Toolkit::DevelAnimatedGradientVisual::Property::END_COLOR, mNormalColor ); | ||
| 487 | + mBackgroundNormalMap.Insert( Toolkit::DevelAnimatedGradientVisual::Property::ROTATE_CENTER, Vector2( 0.0f, 0.0f ) ); | ||
| 488 | + mBackgroundNormalMap.Insert( Toolkit::DevelAnimatedGradientVisual::Property::ROTATE_AMOUNT, 0.0f ); | ||
| 489 | + mBackgroundNormalMap.Insert( Toolkit::DevelAnimatedGradientVisual::Property::OFFSET, 0.0f ); | ||
| 490 | + } | ||
| 491 | + | ||
| 492 | + // Setup background visual property during NFC tagging start | ||
| 493 | + void InitMapStart() | ||
| 494 | + { | ||
| 495 | + mBackgroundMapStart.Clear(); | ||
| 496 | + mBackgroundMapStart.Insert( Visual::Property::TYPE, DevelVisual::ANIMATED_GRADIENT ); | ||
| 497 | + | ||
| 498 | + mBackgroundMapStart.Insert( Toolkit::DevelAnimatedGradientVisual::Property::START_POSITION, Vector2( -0.5, -0.5 ) ); | ||
| 499 | + mBackgroundMapStart.Insert( Toolkit::DevelAnimatedGradientVisual::Property::END_POSITION, Vector2( 0.5, 0.5 ) ); | ||
| 500 | + mBackgroundMapStart.Insert( Toolkit::DevelAnimatedGradientVisual::Property::START_COLOR, mNormalColor ); | ||
| 501 | + mBackgroundMapStart.Insert( Toolkit::DevelAnimatedGradientVisual::Property::END_COLOR, mNormalColor ); | ||
| 502 | + mBackgroundMapStart.Insert( Toolkit::DevelAnimatedGradientVisual::Property::ROTATE_CENTER, Vector2( 0.0f, 0.0f ) ); | ||
| 503 | + mBackgroundMapStart.Insert( Toolkit::DevelAnimatedGradientVisual::Property::ROTATE_AMOUNT, 0.0f ); | ||
| 504 | + mBackgroundMapStart.Insert( Toolkit::DevelAnimatedGradientVisual::Property::OFFSET, BuildMap( 0.0f, 2.0f, 0, mLoadingTime, 0.0f, -1, 0.0f, 0, 0 ) ); | ||
| 505 | + | ||
| 506 | + mColorAnimationStartStart = *( BuildMap( mNormalColor, Vector4( 0, 0, 0, 0 ), 0, mDuration, 0.0f, 1, 0.0f, 0, 0 ).GetMap() ); | ||
| 507 | + mColorAnimationStartEnd = *( BuildMap( mNormalColor, Vector4( 0, 0, 0, 0 ), 0, mDuration, 0.0f, 1, 0.0f, 0, 0 ).GetMap() ); | ||
| 508 | + } | ||
| 509 | + | ||
| 510 | + // Setup background visual property during NFC tagging end | ||
| 511 | + void InitMapEnd() | ||
| 512 | + { | ||
| 513 | + mBackgroundMapEnd.Clear(); | ||
| 514 | + mBackgroundMapEnd.Insert( Visual::Property::TYPE, DevelVisual::ANIMATED_GRADIENT ); | ||
| 515 | + | ||
| 516 | + mBackgroundMapEnd.Insert( Toolkit::DevelAnimatedGradientVisual::Property::START_POSITION, Vector2( -0.5, -0.5 ) ); | ||
| 517 | + mBackgroundMapEnd.Insert( Toolkit::DevelAnimatedGradientVisual::Property::END_POSITION, Vector2( 0.5, 0.5 ) ); | ||
| 518 | + mBackgroundMapEnd.Insert( Toolkit::DevelAnimatedGradientVisual::Property::START_COLOR, mNormalColor ); | ||
| 519 | + mBackgroundMapEnd.Insert( Toolkit::DevelAnimatedGradientVisual::Property::END_COLOR, mNormalColor ); | ||
| 520 | + mBackgroundMapEnd.Insert( Toolkit::DevelAnimatedGradientVisual::Property::ROTATE_CENTER, Vector2( 0.0f, 0.0f ) ); | ||
| 521 | + mBackgroundMapEnd.Insert( Toolkit::DevelAnimatedGradientVisual::Property::ROTATE_AMOUNT, 0.0f ); | ||
| 522 | + mBackgroundMapEnd.Insert( Toolkit::DevelAnimatedGradientVisual::Property::OFFSET, BuildMap( 0.0f, 2.0f, 0, mLoadingTime, 0.0f, -1, 0.0f, 0, 0 ) ); | ||
| 523 | + | ||
| 524 | + mColorAnimationEndStart = *( BuildMap( mNormalColor, Vector4( 0, 0, 0, 0 ), 1, mDuration, 0.0f, 1, 0.0f, 0, 0 ).GetMap() ); | ||
| 525 | + mColorAnimationEndEnd = *( BuildMap( mNormalColor, Vector4( 0, 0, 0, 0 ), 1, mDuration, 0.0f, 1, 0.0f, 0, 0 ).GetMap() ); | ||
| 526 | + } | ||
| 527 | + | ||
| 528 | + // Setup background visual property during card change | ||
| 529 | + void InitMapMove() | ||
| 530 | + { | ||
| 531 | + mBackgroundMapMove.Clear(); | ||
| 532 | + mBackgroundMapMove.Insert( Visual::Property::TYPE, DevelVisual::ANIMATED_GRADIENT); | ||
| 533 | + mBackgroundMapMove.Insert( Toolkit::DevelAnimatedGradientVisual::Property::SPREAD_TYPE, Toolkit::DevelAnimatedGradientVisual::SpreadType::CLAMP); | ||
| 534 | + | ||
| 535 | + mBackgroundMapMove.Insert( Toolkit::DevelAnimatedGradientVisual::Property::START_POSITION, Vector2( -0.5, 0.0 ) ); | ||
| 536 | + mBackgroundMapMove.Insert( Toolkit::DevelAnimatedGradientVisual::Property::END_POSITION, Vector2( 0.5, 0.0 ) ); | ||
| 537 | + mBackgroundMapMove.Insert( Toolkit::DevelAnimatedGradientVisual::Property::START_COLOR, mNormalStartColor ); | ||
| 538 | + mBackgroundMapMove.Insert( Toolkit::DevelAnimatedGradientVisual::Property::END_COLOR, mNormalEndColor ); | ||
| 539 | + mBackgroundMapMove.Insert( Toolkit::DevelAnimatedGradientVisual::Property::ROTATE_CENTER, Vector2( 0.0f, 0.0f ) ); | ||
| 540 | + mBackgroundMapMove.Insert( Toolkit::DevelAnimatedGradientVisual::Property::ROTATE_AMOUNT, 0.0f ); | ||
| 541 | + mBackgroundMapMove.Insert( Toolkit::DevelAnimatedGradientVisual::Property::OFFSET, BuildMap( -1.0f, 1.0f, 0, mCardDuration, 0.0f, 1, 0.0f, 0, 2 ) ); | ||
| 542 | + } | ||
| 543 | + | ||
| 544 | + void InitMap() | ||
| 545 | + { | ||
| 546 | + InitMapNormal(); | ||
| 547 | + InitMapStart(); | ||
| 548 | + InitMapEnd(); | ||
| 549 | + InitMapMove(); | ||
| 550 | + } | ||
| 551 | + | ||
| 552 | + // Setup const parameter values | ||
| 553 | + void BuildParameter() | ||
| 554 | + { | ||
| 555 | + mNormalColor = DEFAULT_COLOR; | ||
| 556 | + mCardDuration = CARD_MOVE_DURATION; | ||
| 557 | + mDuration = CHANGE_DURATION; | ||
| 558 | + mLoadingTime = LOADING_ONE_CYCLE_DURATION; | ||
| 559 | + mLoadingCount = LOADING_CYCLE_CNT; | ||
| 560 | + mLoadingCountScale = LOADING_CYCLE_DT; | ||
| 561 | + | ||
| 562 | + mNormalStartColor = mNormalColor; | ||
| 563 | + mNormalEndColor = mNormalColor; | ||
| 564 | + } | ||
| 565 | + | ||
| 566 | + void BuildAnimation() | ||
| 567 | + { | ||
| 568 | + InitMap(); | ||
| 569 | + } | ||
| 570 | + | ||
| 571 | + void SetupCards() | ||
| 572 | + { | ||
| 573 | + mCards.Init( mStage ); | ||
| 574 | + for( int k = 0; k < CARD_NUM; k++ ) | ||
| 575 | + { | ||
| 576 | + mCards[k].TouchSignal().Connect( this, &CardController::OnTouchCards ); | ||
| 577 | + } | ||
| 578 | + mNormalStartColor = mCards.GetColorBackground( mCards.mCurIndex ); | ||
| 579 | + mNormalEndColor = mCards.GetColorBackground( mCards.mCurIndex ); | ||
| 580 | + } | ||
| 581 | + | ||
| 582 | + // Create and Add to stage | ||
| 583 | + void SetupActors() | ||
| 584 | + { | ||
| 585 | + mAddButton = ImageView::New(); | ||
| 586 | + mAddButton.SetImage( BUTTON_ADD_IMAGE ); | ||
| 587 | + mAddButton.SetParentOrigin( ParentOrigin::BOTTOM_CENTER ); | ||
| 588 | + mAddButton.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER ); | ||
| 589 | + mAddButton.SetSize( BUTTON_ADD_SIZE * SCALED_WIDTH ); | ||
| 590 | + mAddButton.SetPosition( BUTTON_ADD_POSITION * SCALED_WIDTH ); | ||
| 591 | + | ||
| 592 | + mLabel1 = TextLabel::New( LABEL_TICKET_STR ); | ||
| 593 | + mLabel1.SetParentOrigin( ParentOrigin::TOP_CENTER ); | ||
| 594 | + mLabel1.SetAnchorPoint( AnchorPoint::TOP_CENTER ); | ||
| 595 | + mLabel1.SetSize( LABEL_TICKET_SIZE * SCALED_WIDTH ); | ||
| 596 | + mLabel1.SetPosition( LABEL_TICKET_POSITION * SCALED_WIDTH ); | ||
| 597 | + mLabel1.SetVisible( true ); | ||
| 598 | + mLabel1.SetProperty( TextLabel::Property::TEXT_COLOR, LABEL_TICKET_FONT_COLOR ); | ||
| 599 | + mLabel1.SetProperty( TextLabel::Property::POINT_SIZE, LABEL_TICKET_FONT_SIZE * FONT_SCALE ); | ||
| 600 | + mLabel1.SetProperty( TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" ); | ||
| 601 | + mLabel1.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); | ||
| 602 | + | ||
| 603 | + mLabel2 = TextLabel::New( LABEL_HOLD_STR ); | ||
| 604 | + mLabel2.SetParentOrigin( ParentOrigin::CENTER ); | ||
| 605 | + mLabel2.SetAnchorPoint( AnchorPoint::CENTER ); | ||
| 606 | + mLabel2.SetSize( LABEL_HOLD_SIZE * SCALED_WIDTH ); | ||
| 607 | + mLabel2.SetPosition( LABEL_HOLD_POSITION * SCALED_WIDTH ); | ||
| 608 | + mLabel2.SetVisible( false ); | ||
| 609 | + mLabel2.SetProperty( TextLabel::Property::TEXT_COLOR, LABEL_HOLD_FONT_COLOR ); | ||
| 610 | + mLabel2.SetProperty( TextLabel::Property::POINT_SIZE, LABEL_HOLD_FONT_SIZE * FONT_SCALE ); | ||
| 611 | + mLabel2.SetProperty( TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" ); | ||
| 612 | + mLabel2.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); | ||
| 613 | + | ||
| 614 | + mLabel3 = TextLabel::New( LABEL_TERMINAL_STR ); | ||
| 615 | + mLabel3.SetParentOrigin( ParentOrigin::CENTER ); | ||
| 616 | + mLabel3.SetAnchorPoint( AnchorPoint::CENTER ); | ||
| 617 | + mLabel3.SetSize( LABEL_TERMINAL_SIZE * SCALED_WIDTH ); | ||
| 618 | + mLabel3.SetPosition( LABEL_TERMINAL_POSITION * SCALED_WIDTH ); | ||
| 619 | + mLabel3.SetVisible( false ); | ||
| 620 | + mLabel3.SetProperty( TextLabel::Property::TEXT_COLOR, LABEL_TERMINAL_FONT_COLOR ); | ||
| 621 | + mLabel3.SetProperty( TextLabel::Property::POINT_SIZE, LABEL_TERMINAL_FONT_SIZE * FONT_SCALE ); | ||
| 622 | + mLabel3.SetProperty( TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" ); | ||
| 623 | + mLabel3.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); | ||
| 624 | + | ||
| 625 | + mStage.Add( mAddButton ); | ||
| 626 | + mStage.Add( mLabel1 ); | ||
| 627 | + mStage.Add( mLabel2 ); | ||
| 628 | + mStage.Add( mLabel3 ); | ||
| 629 | + } | ||
| 630 | + | ||
| 631 | + void SetupAnimation() | ||
| 632 | + { | ||
| 633 | + mMoveFront = Animation::New( mDuration ); | ||
| 634 | + mMoveBack = Animation::New( mDuration ); | ||
| 635 | + } | ||
| 636 | + | ||
| 637 | + // Run animations when 'index' card active | ||
| 638 | + void RunAnimation(int index) | ||
| 639 | + { | ||
| 640 | + //set animated background color here | ||
| 641 | + mColorAnimationStartStart[DevelAnimatedGradientVisual::AnimationParameter::Property::START] = mNormalStartColor; | ||
| 642 | + mColorAnimationStartEnd[DevelAnimatedGradientVisual::AnimationParameter::Property::START] = mNormalStartColor; | ||
| 643 | + mColorAnimationEndStart[DevelAnimatedGradientVisual::AnimationParameter::Property::START] = mNormalStartColor; | ||
| 644 | + mColorAnimationEndEnd[DevelAnimatedGradientVisual::AnimationParameter::Property::START] = mNormalStartColor; | ||
| 645 | + | ||
| 646 | + mColorAnimationStartStart[DevelAnimatedGradientVisual::AnimationParameter::Property::TARGET] = mCards.GetColorStart( index ); | ||
| 647 | + mColorAnimationStartEnd[DevelAnimatedGradientVisual::AnimationParameter::Property::TARGET] = mCards.GetColorEnd( index ); | ||
| 648 | + mColorAnimationEndStart[DevelAnimatedGradientVisual::AnimationParameter::Property::TARGET] = mCards.GetColorStart( index ); | ||
| 649 | + mColorAnimationEndEnd[DevelAnimatedGradientVisual::AnimationParameter::Property::TARGET] = mCards.GetColorEnd( index ); | ||
| 650 | + | ||
| 651 | + mBackgroundMapStart[Toolkit::DevelAnimatedGradientVisual::Property::START_COLOR] = mColorAnimationStartStart; | ||
| 652 | + mBackgroundMapStart[Toolkit::DevelAnimatedGradientVisual::Property::END_COLOR] = mColorAnimationStartEnd; | ||
| 653 | + mBackgroundMapEnd[Toolkit::DevelAnimatedGradientVisual::Property::START_COLOR] = mColorAnimationEndStart; | ||
| 654 | + mBackgroundMapEnd[Toolkit::DevelAnimatedGradientVisual::Property::END_COLOR] = mColorAnimationEndEnd; | ||
| 655 | + | ||
| 656 | + if( index == 1 ) | ||
| 657 | + { | ||
| 658 | + // Rotate background gradient | ||
| 659 | + mBackgroundMapStart[Toolkit::DevelAnimatedGradientVisual::Property::ROTATE_AMOUNT] = BuildMap( 0.0f, Math::PI * 2.0f, 0, mLoadingTime, 0.0f, -1, 0.0f, 0, 0 ); | ||
| 660 | + } | ||
| 661 | + else if( index == 2 ) | ||
| 662 | + { | ||
| 663 | + // Rotate background gradient more slow | ||
| 664 | + mBackgroundMapStart[Toolkit::DevelAnimatedGradientVisual::Property::ROTATE_AMOUNT] = BuildMap( 0.0f, Math::PI * 2.0f, 0, mLoadingTime * 2.0, 0.0f, -1, 0.0f, 0, 0 ); | ||
| 665 | + } | ||
| 666 | + else | ||
| 667 | + { | ||
| 668 | + mBackgroundMapStart[Toolkit::DevelAnimatedGradientVisual::Property::ROTATE_AMOUNT] = 0.0f; | ||
| 669 | + } | ||
| 670 | + | ||
| 671 | + mBackground.SetProperty( Control::Property::BACKGROUND, mBackgroundMapStart ); | ||
| 672 | + | ||
| 673 | + mTickCount = 0; | ||
| 674 | + mBackgroundChanger = Timer::New( mLoadingTime * 1000.0f / mLoadingCountScale ); | ||
| 675 | + mBackgroundChanger.TickSignal().Connect( this, &CardController::OnTickBackground ); | ||
| 676 | + mBackgroundChanger.Start(); | ||
| 677 | + | ||
| 678 | + mMoveFront.AnimateTo( Property( mCards[index], Actor::Property::SIZE_WIDTH ), CARD_SIZE_BIG.x * SCALED_WIDTH ); | ||
| 679 | + mMoveFront.AnimateTo( Property( mCards[index], Actor::Property::SIZE_HEIGHT ), CARD_SIZE_BIG.y * SCALED_HEIGHT ); | ||
| 680 | + mMoveFront.AnimateTo( Property( mCards[index], Actor::Property::POSITION_Y ), CARD_BIG_OFFSET.y * SCALED_HEIGHT ); | ||
| 681 | + mMoveBack.AnimateTo( Property( mCards[index], Actor::Property::SIZE_WIDTH ), CARD_SIZE.x * SCALED_WIDTH ); | ||
| 682 | + mMoveBack.AnimateTo( Property( mCards[index], Actor::Property::SIZE_HEIGHT ), CARD_SIZE.y * SCALED_HEIGHT ); | ||
| 683 | + mMoveBack.AnimateTo( Property( mCards[index], Actor::Property::POSITION_Y ), CARD_OFFSET.y * SCALED_HEIGHT ); | ||
| 684 | + for( int i = 0; i < index; i++ ) | ||
| 685 | + { | ||
| 686 | + mMoveFront.AnimateBy( Property( mCards[i], Actor::Property::POSITION_X ), -CARD_MOVE_DIST * SCALED_WIDTH ); | ||
| 687 | + mMoveBack.AnimateBy( Property( mCards[i], Actor::Property::POSITION_X ), CARD_MOVE_DIST * SCALED_WIDTH ); | ||
| 688 | + } | ||
| 689 | + for( int i = index + 1; i < CARD_NUM; i++ ) | ||
| 690 | + { | ||
| 691 | + mMoveFront.AnimateBy( Property( mCards[i], Actor::Property::POSITION_X ), CARD_MOVE_DIST * SCALED_WIDTH ); | ||
| 692 | + mMoveBack.AnimateBy( Property( mCards[i], Actor::Property::POSITION_X ), -CARD_MOVE_DIST * SCALED_WIDTH ); | ||
| 693 | + } | ||
| 694 | + mMoveFront.AnimateTo( Property( mAddButton, Actor::Property::POSITION_Y ), BUTTON_ADD_SIZE.y * SCALED_HEIGHT ); | ||
| 695 | + mMoveBack.AnimateTo( Property( mAddButton, Actor::Property::POSITION_Y ), 0.f * SCALED_HEIGHT ); | ||
| 696 | + | ||
| 697 | + mMoveFront.AnimateTo( Property( mLabel1, Actor::Property::VISIBLE), false ); | ||
| 698 | + mMoveFront.AnimateTo( Property( mLabel2, Actor::Property::VISIBLE), true ); | ||
| 699 | + mMoveFront.AnimateTo( Property( mLabel3, Actor::Property::VISIBLE), true ); | ||
| 700 | + mMoveBack.AnimateTo( Property( mLabel1, Actor::Property::VISIBLE), true ); | ||
| 701 | + mMoveBack.AnimateTo( Property( mLabel2, Actor::Property::VISIBLE), false ); | ||
| 702 | + mMoveBack.AnimateTo( Property( mLabel3, Actor::Property::VISIBLE), false ); | ||
| 703 | + | ||
| 704 | + mMoveFront.Play(); | ||
| 705 | + } | ||
| 706 | + bool OnTickBackground() | ||
| 707 | + { | ||
| 708 | + mTickCount++; | ||
| 709 | + if( mCancelSignal || mTickCount >= mLoadingCount * mLoadingCountScale ) | ||
| 710 | + { | ||
| 711 | + if( mCards.mCurState == 1 ) | ||
| 712 | + { | ||
| 713 | + mCards.mCurState = 2; | ||
| 714 | + mBackground.SetProperty( Control::Property::BACKGROUND, mBackgroundMapEnd ); | ||
| 715 | + mMoveBack.Play(); | ||
| 716 | + mBackgroundChanger.SetInterval( mDuration * 1000.0f ); | ||
| 717 | + return true; | ||
| 718 | + } | ||
| 719 | + else | ||
| 720 | + { | ||
| 721 | + Reset(); | ||
| 722 | + return false; | ||
| 723 | + } | ||
| 724 | + } | ||
| 725 | + return true; | ||
| 726 | + } | ||
| 727 | + void MoveRight() | ||
| 728 | + { | ||
| 729 | + if( mCards.MoveRight( mCardDuration ) ) | ||
| 730 | + { | ||
| 731 | + // Set smooth background color change here | ||
| 732 | + mNormalEndColor = mCards.GetColorBackground( mCards.mCurIndex ); | ||
| 733 | + mBackgroundMapMove[Toolkit::DevelAnimatedGradientVisual::Property::START_COLOR] = mNormalEndColor; | ||
| 734 | + mBackgroundMapMove[Toolkit::DevelAnimatedGradientVisual::Property::END_COLOR] = mNormalStartColor; | ||
| 735 | + | ||
| 736 | + (*mBackgroundMapMove[Toolkit::DevelAnimatedGradientVisual::Property::OFFSET].GetMap())[DevelAnimatedGradientVisual::AnimationParameter::Property::DIRECTION] = Property::Value( DevelAnimatedGradientVisual::AnimationParameter::DirectionType::BACKWARD ); | ||
| 737 | + | ||
| 738 | + mBackground.SetProperty( Control::Property::BACKGROUND, mBackgroundMapMove ); | ||
| 739 | + } | ||
| 740 | + } | ||
| 741 | + void MoveLeft() | ||
| 742 | + { | ||
| 743 | + if( mCards.MoveLeft( mCardDuration ) ) | ||
| 744 | + { | ||
| 745 | + //Set smooth background color change here | ||
| 746 | + mNormalEndColor = mCards.GetColorBackground( mCards.mCurIndex ); | ||
| 747 | + mBackgroundMapMove[Toolkit::DevelAnimatedGradientVisual::Property::START_COLOR] = mNormalStartColor; | ||
| 748 | + mBackgroundMapMove[Toolkit::DevelAnimatedGradientVisual::Property::END_COLOR] = mNormalEndColor; | ||
| 749 | + | ||
| 750 | + (*mBackgroundMapMove[Toolkit::DevelAnimatedGradientVisual::Property::OFFSET].GetMap())[DevelAnimatedGradientVisual::AnimationParameter::Property::DIRECTION] = Property::Value( DevelAnimatedGradientVisual::AnimationParameter::DirectionType::FORWARD ); | ||
| 751 | + | ||
| 752 | + mBackground.SetProperty( Control::Property::BACKGROUND, mBackgroundMapMove ); | ||
| 753 | + } | ||
| 754 | + } | ||
| 755 | + | ||
| 756 | + void Reset() | ||
| 757 | + { | ||
| 758 | + mCards.mCurState = 0; | ||
| 759 | + mCancelSignal = false; | ||
| 760 | + mMoveFront.Clear(); | ||
| 761 | + mMoveBack.Clear(); | ||
| 762 | + | ||
| 763 | + mNormalStartColor = mNormalEndColor; | ||
| 764 | + mBackgroundNormalMap[Toolkit::DevelAnimatedGradientVisual::Property::START_COLOR] = mNormalStartColor; | ||
| 765 | + mBackgroundNormalMap[Toolkit::DevelAnimatedGradientVisual::Property::END_COLOR] = mNormalEndColor; | ||
| 766 | + mBackground.SetProperty(Control::Property::BACKGROUND, mBackgroundNormalMap); | ||
| 767 | + } | ||
| 768 | + | ||
| 769 | +private: | ||
| 770 | + Application& mApplication; | ||
| 771 | + Stage mStage; | ||
| 772 | + | ||
| 773 | + CardManager mCards; | ||
| 774 | + | ||
| 775 | + Control mBackground; | ||
| 776 | + | ||
| 777 | + ImageView mAddButton; | ||
| 778 | + TextLabel mLabel1; | ||
| 779 | + TextLabel mLabel2; | ||
| 780 | + TextLabel mLabel3; | ||
| 781 | + | ||
| 782 | + Timer mBackgroundChanger; | ||
| 783 | + Timer mCardChanger; | ||
| 784 | + Timer mTempTimer; | ||
| 785 | + | ||
| 786 | + Animation mMoveFront; | ||
| 787 | + Animation mMoveBack; | ||
| 788 | + | ||
| 789 | + // Property for background animated gradient visual | ||
| 790 | + Property::Map mBackgroundNormalMap; | ||
| 791 | + Property::Map mBackgroundMapStart; | ||
| 792 | + Property::Map mBackgroundMapEnd; | ||
| 793 | + Property::Map mBackgroundMapMove; | ||
| 794 | + | ||
| 795 | + // Property for animation of color in animated gradient visual | ||
| 796 | + Property::Map mColorAnimationStartStart; | ||
| 797 | + Property::Map mColorAnimationStartEnd; | ||
| 798 | + Property::Map mColorAnimationEndStart; | ||
| 799 | + Property::Map mColorAnimationEndEnd; | ||
| 800 | + | ||
| 801 | + Vector4 mNormalColor; | ||
| 802 | + Vector4 mNormalStartColor; | ||
| 803 | + Vector4 mNormalEndColor; | ||
| 804 | + | ||
| 805 | + Vector2 mFirstTouchPos; | ||
| 806 | + Vector2 mLastTouchPos; | ||
| 807 | + | ||
| 808 | + float mCardDuration; | ||
| 809 | + float mDuration; | ||
| 810 | + float mLoadingTime; | ||
| 811 | + int mLoadingCount; | ||
| 812 | + int mLoadingCountScale; | ||
| 813 | + int mTickCount; | ||
| 814 | + | ||
| 815 | + bool mCancelSignal; | ||
| 816 | + bool mIsTouchedActor; | ||
| 817 | +}; | ||
| 818 | + | ||
| 819 | +int main(int argc, char **argv) | ||
| 820 | +{ | ||
| 821 | + Application application = Application::New( &argc, &argv ); | ||
| 822 | + | ||
| 823 | + CardController test( application ); | ||
| 824 | + | ||
| 825 | + application.MainLoop(); | ||
| 826 | + | ||
| 827 | + return 0; | ||
| 828 | +} |
packaging/com.samsung.dali-demo.spec
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | 2 | ||
| 3 | Name: com.samsung.dali-demo | 3 | Name: com.samsung.dali-demo |
| 4 | Summary: The OpenGLES Canvas Core Demo | 4 | Summary: The OpenGLES Canvas Core Demo |
| 5 | -Version: 1.3.0 | 5 | +Version: 1.3.1 |
| 6 | Release: 1 | 6 | Release: 1 |
| 7 | Group: System/Libraries | 7 | Group: System/Libraries |
| 8 | License: Apache-2.0 | 8 | License: Apache-2.0 |
resources/images/Call_Accept.png
0 → 100644
1.05 KB
resources/images/Call_Battery.png
0 → 100644
136 Bytes
resources/images/Call_Decline.png
0 → 100644
872 Bytes
resources/images/Call_Decline_wh.png
0 → 100644
674 Bytes
resources/images/Card_01.png
0 → 100644
11.6 KB
resources/images/Card_02.png
0 → 100644
11.9 KB
resources/images/Card_03.png
0 → 100644
14 KB
resources/images/Card_Add_Button.png
0 → 100644
1.64 KB
resources/po/en_GB.po
| @@ -19,6 +19,12 @@ msgstr "Bubbles" | @@ -19,6 +19,12 @@ msgstr "Bubbles" | ||
| 19 | msgid "DALI_DEMO_STR_TITLE_BUTTONS" | 19 | msgid "DALI_DEMO_STR_TITLE_BUTTONS" |
| 20 | msgstr "Buttons" | 20 | msgstr "Buttons" |
| 21 | 21 | ||
| 22 | +msgid "DALI_DEMO_STR_TITLE_CALL_ACTIVE" | ||
| 23 | +msgstr "Call Active" | ||
| 24 | + | ||
| 25 | +msgid "DALI_DEMO_STR_TITLE_CARD_ACTIVE" | ||
| 26 | +msgstr "Card Active" | ||
| 27 | + | ||
| 22 | msgid "DALI_DEMO_STR_TITLE_CLIPPING" | 28 | msgid "DALI_DEMO_STR_TITLE_CLIPPING" |
| 23 | msgstr "Clipping" | 29 | msgstr "Clipping" |
| 24 | 30 |
resources/po/en_US.po
| @@ -19,6 +19,12 @@ msgstr "Bubbles" | @@ -19,6 +19,12 @@ msgstr "Bubbles" | ||
| 19 | msgid "DALI_DEMO_STR_TITLE_BUTTONS" | 19 | msgid "DALI_DEMO_STR_TITLE_BUTTONS" |
| 20 | msgstr "Buttons" | 20 | msgstr "Buttons" |
| 21 | 21 | ||
| 22 | +msgid "DALI_DEMO_STR_TITLE_CALL_ACTIVE" | ||
| 23 | +msgstr "Call Active" | ||
| 24 | + | ||
| 25 | +msgid "DALI_DEMO_STR_TITLE_CARD_ACTIVE" | ||
| 26 | +msgstr "Card Active" | ||
| 27 | + | ||
| 22 | msgid "DALI_DEMO_STR_TITLE_CLIPPING" | 28 | msgid "DALI_DEMO_STR_TITLE_CLIPPING" |
| 23 | msgstr "Clipping" | 29 | msgstr "Clipping" |
| 24 | 30 |
resources/po/ko.po
| @@ -16,6 +16,12 @@ msgstr "방울" | @@ -16,6 +16,12 @@ msgstr "방울" | ||
| 16 | msgid "DALI_DEMO_STR_TITLE_BUTTONS" | 16 | msgid "DALI_DEMO_STR_TITLE_BUTTONS" |
| 17 | msgstr "버튼" | 17 | msgstr "버튼" |
| 18 | 18 | ||
| 19 | +msgid "DALI_DEMO_STR_TITLE_CALL_ACTIVE" | ||
| 20 | +msgstr "통화 수신" | ||
| 21 | + | ||
| 22 | +msgid "DALI_DEMO_STR_TITLE_CARD_ACTIVE" | ||
| 23 | +msgstr "NFC 카드 태깅" | ||
| 24 | + | ||
| 19 | msgid "DALI_DEMO_STR_TITLE_CLIPPING" | 25 | msgid "DALI_DEMO_STR_TITLE_CLIPPING" |
| 20 | msgstr "깎는" | 26 | msgstr "깎는" |
| 21 | 27 |
resources/style/.gitignore
resources/style/animated-gradient-call-active-style.json.in
0 → 100644
| 1 | +{ | ||
| 2 | + "styles": { | ||
| 3 | + "IncomeBackground": { | ||
| 4 | + "background": { | ||
| 5 | + "visualType": "ANIMATED_GRADIENT", | ||
| 6 | + "gradientType": "RADIAL", | ||
| 7 | + "unitType": "USER_SPACE", | ||
| 8 | + "startPosition": [0.0, 0.0], | ||
| 9 | + "endPosition": [180.0, 0.0], | ||
| 10 | + "startColor": [0.1333, 0.1647, 0.2941, 1.0], | ||
| 11 | + "endColor": [0.0784, 0.3961, 0.4863, 1.0], | ||
| 12 | + "rotateCenter": [0.0, 0.0], | ||
| 13 | + "rotateAmount": 0.0, | ||
| 14 | + "offset": { | ||
| 15 | + "startValue": 0.0, | ||
| 16 | + "targetValue": 2.0, | ||
| 17 | + "directionType": "BACKWARD", | ||
| 18 | + "duration": 1.25, | ||
| 19 | + "delay": 0.0, | ||
| 20 | + "repeat": -1, | ||
| 21 | + "repeatDelay": 0.0, | ||
| 22 | + "motionType": "LOOP", | ||
| 23 | + "easingType": "LINEAR" | ||
| 24 | + } | ||
| 25 | + } | ||
| 26 | + }, | ||
| 27 | + "ActiveBackground":{ | ||
| 28 | + "background":{ | ||
| 29 | + "visualType": "ANIMATED_GRADIENT", | ||
| 30 | + "gradientType": "RADIAL", | ||
| 31 | + "unitType": "USER_SPACE", | ||
| 32 | + "startPosition": [0.0, 0.0], | ||
| 33 | + "endPosition": [180.0, 0.0], | ||
| 34 | + "startColor": [0.1066, 0.1318, 0.2353, 1.0], | ||
| 35 | + "endColor": [0.0627, 0.3169, 0.3890, 1.0], | ||
| 36 | + "rotateCenter": [0.0, 0.0], | ||
| 37 | + "rotateAmount": 0.0, | ||
| 38 | + "offset": { | ||
| 39 | + "startValue": 0.0, | ||
| 40 | + "targetValue": 2.0, | ||
| 41 | + "directionType": "BACKWARD", | ||
| 42 | + "duration": 4.0, | ||
| 43 | + "delay": 0.0, | ||
| 44 | + "repeat": -1, | ||
| 45 | + "repeatDelay": 0.0, | ||
| 46 | + "motionType": "LOOP", | ||
| 47 | + "easingType": "LINEAR" | ||
| 48 | + } | ||
| 49 | + } | ||
| 50 | + }, | ||
| 51 | + "DeclineButton":{ | ||
| 52 | + "background":{ | ||
| 53 | + "visualType": "ANIMATED_GRADIENT", | ||
| 54 | + "gradientType": "LINEAR", | ||
| 55 | + "unitType": "USER_SPACE", | ||
| 56 | + "startPosition": [-180.0, 0.0], | ||
| 57 | + "endPosition": [180.0, 0.0], | ||
| 58 | + "startColor": [0.8941, 0.0078, 0.0078, 1.0], | ||
| 59 | + "endColor": [1.0000, 0.5961, 0.0000, 1.0], | ||
| 60 | + "rotateCenter": [0.0, 0.0], | ||
| 61 | + "rotateAmount": 0.78539816, | ||
| 62 | + "offset": { | ||
| 63 | + "startValue": 0.0, | ||
| 64 | + "targetValue": 2.0, | ||
| 65 | + "directionType": "FORWARD", | ||
| 66 | + "duration": 1.8, | ||
| 67 | + "delay": -1.2, | ||
| 68 | + "repeat": -1, | ||
| 69 | + "repeatDelay": 1.2, | ||
| 70 | + "motionType": "LOOP", | ||
| 71 | + "easingType": "IN_OUT" | ||
| 72 | + } | ||
| 73 | + } | ||
| 74 | + } | ||
| 75 | + } | ||
| 76 | +} |
resources/style/mobile/animated-gradient-call-active-style.json.in
0 → 100644
| 1 | +{ | ||
| 2 | + "styles": { | ||
| 3 | + "IncomeBackground": { | ||
| 4 | + "background": { | ||
| 5 | + "visualType": "ANIMATED_GRADIENT", | ||
| 6 | + "gradientType": "RADIAL", | ||
| 7 | + "unitType": "USER_SPACE", | ||
| 8 | + "startPosition": [0.0, 0.0], | ||
| 9 | + "endPosition": [180.0, 0.0], | ||
| 10 | + "startColor": [0.1333, 0.1647, 0.2941, 1.0], | ||
| 11 | + "endColor": [0.0784, 0.3961, 0.4863, 1.0], | ||
| 12 | + "rotateCenter": [0.0, 0.0], | ||
| 13 | + "rotateAmount": 0.0, | ||
| 14 | + "offset": { | ||
| 15 | + "startValue": 0.0, | ||
| 16 | + "targetValue": 2.0, | ||
| 17 | + "directionType": "BACKWARD", | ||
| 18 | + "duration": 1.25, | ||
| 19 | + "delay": 0.0, | ||
| 20 | + "repeat": -1, | ||
| 21 | + "repeatDelay": 0.0, | ||
| 22 | + "motionType": "LOOP", | ||
| 23 | + "easingType": "LINEAR" | ||
| 24 | + } | ||
| 25 | + } | ||
| 26 | + }, | ||
| 27 | + "ActiveBackground":{ | ||
| 28 | + "background":{ | ||
| 29 | + "visualType": "ANIMATED_GRADIENT", | ||
| 30 | + "gradientType": "RADIAL", | ||
| 31 | + "unitType": "USER_SPACE", | ||
| 32 | + "startPosition": [0.0, 0.0], | ||
| 33 | + "endPosition": [180.0, 0.0], | ||
| 34 | + "startColor": [0.1066, 0.1318, 0.2353, 1.0], | ||
| 35 | + "endColor": [0.0627, 0.3169, 0.3890, 1.0], | ||
| 36 | + "rotateCenter": [0.0, 0.0], | ||
| 37 | + "rotateAmount": 0.0, | ||
| 38 | + "offset": { | ||
| 39 | + "startValue": 0.0, | ||
| 40 | + "targetValue": 2.0, | ||
| 41 | + "directionType": "BACKWARD", | ||
| 42 | + "duration": 4.0, | ||
| 43 | + "delay": 0.0, | ||
| 44 | + "repeat": -1, | ||
| 45 | + "repeatDelay": 0.0, | ||
| 46 | + "motionType": "LOOP", | ||
| 47 | + "easingType": "LINEAR" | ||
| 48 | + } | ||
| 49 | + } | ||
| 50 | + }, | ||
| 51 | + "DeclineButton":{ | ||
| 52 | + "background":{ | ||
| 53 | + "visualType": "ANIMATED_GRADIENT", | ||
| 54 | + "gradientType": "LINEAR", | ||
| 55 | + "unitType": "USER_SPACE", | ||
| 56 | + "startPosition": [-180.0, 0.0], | ||
| 57 | + "endPosition": [180.0, 0.0], | ||
| 58 | + "startColor": [0.8941, 0.0078, 0.0078, 1.0], | ||
| 59 | + "endColor": [1.0000, 0.5961, 0.0000, 1.0], | ||
| 60 | + "rotateCenter": [0.0, 0.0], | ||
| 61 | + "rotateAmount": 0.78539816, | ||
| 62 | + "offset": { | ||
| 63 | + "startValue": 0.0, | ||
| 64 | + "targetValue": 2.0, | ||
| 65 | + "directionType": "FORWARD", | ||
| 66 | + "duration": 1.8, | ||
| 67 | + "delay": -1.2, | ||
| 68 | + "repeat": -1, | ||
| 69 | + "repeatDelay": 1.2, | ||
| 70 | + "motionType": "LOOP", | ||
| 71 | + "easingType": "IN_OUT" | ||
| 72 | + } | ||
| 73 | + } | ||
| 74 | + } | ||
| 75 | + } | ||
| 76 | +} |
shared/dali-demo-strings.h
| @@ -39,6 +39,8 @@ extern "C" | @@ -39,6 +39,8 @@ extern "C" | ||
| 39 | #define DALI_DEMO_STR_TITLE_BLOCKS dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_BLOCKS") | 39 | #define DALI_DEMO_STR_TITLE_BLOCKS dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_BLOCKS") |
| 40 | #define DALI_DEMO_STR_TITLE_BUBBLES dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_BUBBLES") | 40 | #define DALI_DEMO_STR_TITLE_BUBBLES dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_BUBBLES") |
| 41 | #define DALI_DEMO_STR_TITLE_BUTTONS dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_BUTTONS") | 41 | #define DALI_DEMO_STR_TITLE_BUTTONS dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_BUTTONS") |
| 42 | +#define DALI_DEMO_STR_TITLE_CALL_ACTIVE dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_CALL_ACTIVE") | ||
| 43 | +#define DALI_DEMO_STR_TITLE_CARD_ACTIVE dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_CARD_ACTIVE") | ||
| 42 | #define DALI_DEMO_STR_TITLE_CLIPPING dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_CLIPPING") | 44 | #define DALI_DEMO_STR_TITLE_CLIPPING dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_CLIPPING") |
| 43 | #define DALI_DEMO_STR_TITLE_CLIPPING_DRAW_ORDER dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_CLIPPING_DRAW_ORDER") | 45 | #define DALI_DEMO_STR_TITLE_CLIPPING_DRAW_ORDER dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_CLIPPING_DRAW_ORDER") |
| 44 | #define DALI_DEMO_STR_TITLE_COLOR_GRADIENT dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_COLOR_GRADIENT") | 46 | #define DALI_DEMO_STR_TITLE_COLOR_GRADIENT dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_COLOR_GRADIENT") |
| @@ -110,6 +112,8 @@ extern "C" | @@ -110,6 +112,8 @@ extern "C" | ||
| 110 | #define DALI_DEMO_STR_TITLE_BLOCKS "Blocks" | 112 | #define DALI_DEMO_STR_TITLE_BLOCKS "Blocks" |
| 111 | #define DALI_DEMO_STR_TITLE_BUBBLES "Bubbles" | 113 | #define DALI_DEMO_STR_TITLE_BUBBLES "Bubbles" |
| 112 | #define DALI_DEMO_STR_TITLE_BUTTONS "Buttons" | 114 | #define DALI_DEMO_STR_TITLE_BUTTONS "Buttons" |
| 115 | +#define DALI_DEMO_STR_TITLE_CALL_ACTIVE "Call Active" | ||
| 116 | +#define DALI_DEMO_STR_TITLE_CARD_ACTIVE "Card Active" | ||
| 113 | #define DALI_DEMO_STR_TITLE_CLIPPING "Clipping" | 117 | #define DALI_DEMO_STR_TITLE_CLIPPING "Clipping" |
| 114 | #define DALI_DEMO_STR_TITLE_CLIPPING_DRAW_ORDER "Clipping Draw Order" | 118 | #define DALI_DEMO_STR_TITLE_CLIPPING_DRAW_ORDER "Clipping Draw Order" |
| 115 | #define DALI_DEMO_STR_TITLE_COLOR_GRADIENT "Color Gradient" | 119 | #define DALI_DEMO_STR_TITLE_COLOR_GRADIENT "Color Gradient" |