Commit ff26cb3dbec13a7a6c101dc3072d8f006109c831
[dali_1.2.23] Merge branch 'devel/master'
Change-Id: I6233ca82bea0a578796c5f493539816ed793d2a5
Showing
28 changed files
with
1780 additions
and
545 deletions
build/tizen/.gitignore
examples/animated-images/animated-images-example.cpp
| ... | ... | @@ -34,6 +34,9 @@ const char* const ANIMATE_GIF_DOG( DEMO_IMAGE_DIR "dog-anim.gif" ); |
| 34 | 34 | const char* const STATIC_GIF_LOGO( DEMO_IMAGE_DIR "dali-logo-static.gif" ); |
| 35 | 35 | const char* const ANIMATE_GIF_LOGO( DEMO_IMAGE_DIR "dali-logo-anim.gif" ); |
| 36 | 36 | |
| 37 | +const char* const ANIMATE_PIXEL_AREA( "Animate PixelArea" ); | |
| 38 | +const char* const ANIMATE_PIXEL_AREA_AND_SCALE( "Animate PixelArea & Scale" ); | |
| 39 | + | |
| 37 | 40 | const Vector4 DIM_COLOR( 0.85f, 0.85f, 0.85f, 0.85f ); |
| 38 | 41 | } |
| 39 | 42 | |
| ... | ... | @@ -67,21 +70,24 @@ public: |
| 67 | 70 | // Tie-in input event handlers: |
| 68 | 71 | stage.KeyEventSignal().Connect( this, &AnimatedImageController::OnKeyEvent ); |
| 69 | 72 | |
| 70 | - mActorDog = CreateGifViewWithOverlayButton( STATIC_GIF_DOG ); | |
| 73 | + mActorDog = CreateGifViewWithOverlayPlayButton( STATIC_GIF_DOG ); | |
| 71 | 74 | mActorDog.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER ); |
| 72 | 75 | mActorDog.SetY( -100.f ); |
| 73 | 76 | stage.Add( mActorDog ); |
| 74 | 77 | |
| 75 | - mActorLogo = CreateGifViewWithOverlayButton( STATIC_GIF_LOGO ); | |
| 78 | + mActorLogo = CreateGifViewWithOverlayPlayButton( STATIC_GIF_LOGO ); | |
| 76 | 79 | mActorLogo.SetAnchorPoint( AnchorPoint::TOP_CENTER ); |
| 77 | 80 | mActorLogo.SetY( 100.f ); |
| 78 | 81 | stage.Add( mActorLogo ); |
| 82 | + | |
| 83 | + mTapDetector = TapGestureDetector::New(); | |
| 84 | + mTapDetector.DetectedSignal().Connect( this, &AnimatedImageController::OnTap ); | |
| 79 | 85 | } |
| 80 | 86 | |
| 81 | 87 | /** |
| 82 | 88 | * Create the gif image view with an overlay play button. |
| 83 | 89 | */ |
| 84 | - Toolkit::ImageView CreateGifViewWithOverlayButton( const std::string& gifUrl ) | |
| 90 | + Toolkit::ImageView CreateGifViewWithOverlayPlayButton( const std::string& gifUrl ) | |
| 85 | 91 | { |
| 86 | 92 | Toolkit::ImageView imageView = Toolkit::ImageView::New( gifUrl ); |
| 87 | 93 | imageView.SetParentOrigin( ParentOrigin::CENTER ); |
| ... | ... | @@ -101,6 +107,32 @@ public: |
| 101 | 107 | return imageView; |
| 102 | 108 | } |
| 103 | 109 | |
| 110 | + Toolkit::ImageView CreateGifViewWithAnimatePixelAreaButton( const std::string& gifUrl, WrapMode::Type wrapModeU, WrapMode::Type wrapModeV, const std::string& buttonLabel ) | |
| 111 | + { | |
| 112 | + Toolkit::ImageView imageView = Toolkit::ImageView::New(); | |
| 113 | + imageView.SetProperty( Toolkit::ImageView::Property::IMAGE, | |
| 114 | + Property::Map().Add( Toolkit::ImageVisual::Property::URL, gifUrl ) | |
| 115 | + .Add( Toolkit::ImageVisual::Property::WRAP_MODE_U, wrapModeU ) | |
| 116 | + .Add( Toolkit::ImageVisual::Property::WRAP_MODE_V, wrapModeV )); | |
| 117 | + imageView.SetParentOrigin( ParentOrigin::CENTER ); | |
| 118 | + | |
| 119 | + // Create a push button, and add it as child of the image view | |
| 120 | + Toolkit::PushButton animateButton = Toolkit::PushButton::New(); | |
| 121 | + animateButton.SetProperty( Toolkit::Button::Property::LABEL, buttonLabel ); | |
| 122 | + animateButton.SetParentOrigin( ParentOrigin::BOTTOM_CENTER ); | |
| 123 | + animateButton.SetAnchorPoint( AnchorPoint::TOP_CENTER ); | |
| 124 | + animateButton.SetY( 20.f ); | |
| 125 | + | |
| 126 | + animateButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); | |
| 127 | + animateButton.SetProperty( Actor::Property::INHERIT_SCALE, false ); | |
| 128 | + imageView.Add( animateButton ); | |
| 129 | + | |
| 130 | + mTapDetector.Attach( animateButton ); | |
| 131 | + mTapDetector.Attach( imageView ); | |
| 132 | + | |
| 133 | + return imageView; | |
| 134 | + } | |
| 135 | + | |
| 104 | 136 | bool OnPlayButtonClicked( Toolkit::Button button ) |
| 105 | 137 | { |
| 106 | 138 | Stage stage = Stage::GetCurrent(); |
| ... | ... | @@ -111,8 +143,7 @@ public: |
| 111 | 143 | // remove the static gif view, the play button is also removed as its child. |
| 112 | 144 | stage.Remove( mActorDog ); |
| 113 | 145 | |
| 114 | - mActorDog = Toolkit::ImageView::New( ANIMATE_GIF_DOG ); | |
| 115 | - mActorDog.SetParentOrigin( ParentOrigin::CENTER ); | |
| 146 | + mActorDog = CreateGifViewWithAnimatePixelAreaButton( ANIMATE_GIF_DOG, WrapMode::REPEAT, WrapMode::DEFAULT, ANIMATE_PIXEL_AREA_AND_SCALE ); | |
| 116 | 147 | mActorDog.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER ); |
| 117 | 148 | mActorDog.SetY( -100.f ); |
| 118 | 149 | stage.Add( mActorDog ); |
| ... | ... | @@ -122,8 +153,7 @@ public: |
| 122 | 153 | // remove the static gif view, the play button is also removed as its child. |
| 123 | 154 | stage.Remove( mActorLogo ); |
| 124 | 155 | |
| 125 | - mActorLogo = Toolkit::ImageView::New( ANIMATE_GIF_LOGO ); | |
| 126 | - mActorLogo.SetParentOrigin( ParentOrigin::CENTER ); | |
| 156 | + mActorLogo = CreateGifViewWithAnimatePixelAreaButton( ANIMATE_GIF_LOGO, WrapMode::DEFAULT, WrapMode::MIRRORED_REPEAT, ANIMATE_PIXEL_AREA ); | |
| 127 | 157 | mActorLogo.SetAnchorPoint( AnchorPoint::TOP_CENTER ); |
| 128 | 158 | mActorLogo.SetY( 100.f ); |
| 129 | 159 | stage.Add( mActorLogo ); |
| ... | ... | @@ -131,6 +161,42 @@ public: |
| 131 | 161 | return true; |
| 132 | 162 | } |
| 133 | 163 | |
| 164 | + void OnTap(Dali::Actor actor, const Dali::TapGesture& tap) | |
| 165 | + { | |
| 166 | + if( actor.GetParent() == mActorDog ) // "Animate Pixel Area" button is clicked | |
| 167 | + { | |
| 168 | + Animation animation = Animation::New( 3.f ); | |
| 169 | + animation.AnimateTo( Property( mActorDog, ImageView::Property::PIXEL_AREA ), Vector4( -1.0, 0.0, 3.f, 1.f ), AlphaFunction::SIN ); | |
| 170 | + animation.AnimateTo( Property( mActorDog, Actor::Property::SCALE_X ), 3.f, AlphaFunction::SIN ); | |
| 171 | + animation.Play(); | |
| 172 | + } | |
| 173 | + else if( actor.GetParent() == mActorLogo ) // "Animate Pixel Area" button is clicked | |
| 174 | + { | |
| 175 | + Animation animation = Animation::New( 3.f ); | |
| 176 | + animation.AnimateTo( Property( mActorLogo, ImageView::Property::PIXEL_AREA ), Vector4( 0.0, 1.0, 1.f, 1.f ), AlphaFunction::SIN ); | |
| 177 | + animation.Play(); | |
| 178 | + } | |
| 179 | + else if( actor == mActorDog ) // stop the animated gif, switch to static view | |
| 180 | + { | |
| 181 | + Stage stage = Stage::GetCurrent(); | |
| 182 | + stage.Remove( mActorDog ); | |
| 183 | + | |
| 184 | + mActorDog = CreateGifViewWithOverlayPlayButton( STATIC_GIF_DOG ); | |
| 185 | + mActorDog.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER ); | |
| 186 | + mActorDog.SetY( -100.f ); | |
| 187 | + stage.Add( mActorDog ); | |
| 188 | + } | |
| 189 | + else if( actor == mActorLogo ) // stop the animated gif, switch to static view | |
| 190 | + { | |
| 191 | + Stage stage = Stage::GetCurrent(); | |
| 192 | + stage.Remove( mActorLogo ); | |
| 193 | + | |
| 194 | + mActorLogo = CreateGifViewWithOverlayPlayButton( STATIC_GIF_LOGO ); | |
| 195 | + mActorLogo.SetAnchorPoint( AnchorPoint::TOP_CENTER ); | |
| 196 | + mActorLogo.SetY( 100.f ); | |
| 197 | + stage.Add( mActorLogo ); | |
| 198 | + } | |
| 199 | + } | |
| 134 | 200 | |
| 135 | 201 | void OnKeyEvent(const KeyEvent& event) |
| 136 | 202 | { |
| ... | ... | @@ -147,6 +213,7 @@ private: |
| 147 | 213 | Application& mApplication; |
| 148 | 214 | Toolkit::ImageView mActorDog; |
| 149 | 215 | Toolkit::ImageView mActorLogo; |
| 216 | + TapGestureDetector mTapDetector; | |
| 150 | 217 | }; |
| 151 | 218 | |
| 152 | 219 | // Entry point for Linux & Tizen applications | ... | ... |
examples/clipping/clipping-example.cpp
| ... | ... | @@ -24,6 +24,7 @@ |
| 24 | 24 | |
| 25 | 25 | // INTERNAL INCLUDES |
| 26 | 26 | #include "clipping-item-factory.h" |
| 27 | +#include "item-view-orientation-constraint.h" | |
| 27 | 28 | |
| 28 | 29 | using namespace Dali; |
| 29 | 30 | using namespace Dali::Toolkit; |
| ... | ... | @@ -32,8 +33,13 @@ namespace |
| 32 | 33 | { |
| 33 | 34 | const char * const APPLICATION_TITLE( "Clipping Controls" ); |
| 34 | 35 | const Vector3 APPLICATION_TITLE_PARENT_ORIGIN( 0.5f, 0.03f, 0.5f ); // Set the parent origin to a small percentage below the top (so the demo will scale for different resolutions). |
| 36 | + | |
| 35 | 37 | const Vector3 ITEM_VIEW_LAYOUT_SIZE_SCALE( 0.75f, 0.5f, 0.75f ); |
| 36 | 38 | const float ITEM_VIEW_BORDER_SIZE = 2.0f; |
| 39 | +const float ITEM_VIEW_MAXIMUM_ROTATION_IN_DEGREES = 20.0f; | |
| 40 | +const float ITEM_VIEW_LAYOUT_POSITION_CHANGE_MULTIPLIER = 3.0f; | |
| 41 | +const float ITEM_VIEW_ROTATION_ANIMATION_TIME = 0.2f; | |
| 42 | + | |
| 37 | 43 | const char * const BUTTON_LABEL( "Toggle Clipping Mode" ); |
| 38 | 44 | } // unnamed namespace |
| 39 | 45 | |
| ... | ... | @@ -44,6 +50,8 @@ const char * const BUTTON_LABEL( "Toggle Clipping Mode" ); |
| 44 | 50 | * need to clip to. UI Controls automate the creation of the renderers/visuals when they are set to clip their children. |
| 45 | 51 | * |
| 46 | 52 | * This example displays an item-view whose clipping mode is toggled without the need for adding any renderers to it. |
| 53 | + * | |
| 54 | + * Additionally, a constraint is used to modify the item-view's orientation. | |
| 47 | 55 | */ |
| 48 | 56 | class ClippingExample : public ConnectionTracker |
| 49 | 57 | { |
| ... | ... | @@ -100,6 +108,14 @@ private: |
| 100 | 108 | const Vector3 itemViewLayoutSize( ITEM_VIEW_LAYOUT_SIZE_SCALE.x * stageSize.x, ITEM_VIEW_LAYOUT_SIZE_SCALE.y * stageSize.y, ITEM_VIEW_LAYOUT_SIZE_SCALE.z * stageSize.x ); |
| 101 | 109 | mItemView.ActivateLayout( 0, itemViewLayoutSize, 0.0f ); |
| 102 | 110 | |
| 111 | + // Connect to the scroll started and completed signals to apply orientation constraints & animations. | |
| 112 | + mItemView.ScrollStartedSignal().Connect( this, &ClippingExample::ScrollStarted ); | |
| 113 | + mItemView.ScrollCompletedSignal().Connect( this, &ClippingExample::ScrollCompleted ); | |
| 114 | + | |
| 115 | + // Create a constraint for the item-view which we apply when we start scrolling and remove when we stop. | |
| 116 | + mItemViewOrientationConstraint = Constraint::New< Quaternion >( mItemView, Actor::Property::ORIENTATION, ItemViewOrientationConstraint( ITEM_VIEW_MAXIMUM_ROTATION_IN_DEGREES, ITEM_VIEW_LAYOUT_POSITION_CHANGE_MULTIPLIER ) ); | |
| 117 | + mItemViewOrientationConstraint.AddSource( LocalSource( ItemView::Property::LAYOUT_POSITION ) ); | |
| 118 | + | |
| 103 | 119 | // Create a border around item-view (as item-view is clipping its children, we should NOT add this as a child of item-view). |
| 104 | 120 | Control border = Control::New(); |
| 105 | 121 | border.SetParentOrigin( ParentOrigin::CENTER ); |
| ... | ... | @@ -107,10 +123,16 @@ private: |
| 107 | 123 | border.SetProperty( Control::Property::BACKGROUND, |
| 108 | 124 | Property::Map().Add( Visual::Property::TYPE, Visual::BORDER ) |
| 109 | 125 | .Add( BorderVisual::Property::COLOR, Color::WHITE ) |
| 110 | - .Add( BorderVisual::Property::SIZE, 2.0f ) ); | |
| 126 | + .Add( BorderVisual::Property::SIZE, 2.0f ) | |
| 127 | + .Add( BorderVisual::Property::ANTI_ALIASING, true ) ); | |
| 111 | 128 | border.SetSize( Vector3( itemViewLayoutSize.x + ITEM_VIEW_BORDER_SIZE * 2.0f, itemViewLayoutSize.y + ITEM_VIEW_BORDER_SIZE * 2.0f, itemViewLayoutSize.z + ITEM_VIEW_BORDER_SIZE * 2.0f ) ); |
| 112 | 129 | stage.Add( border ); |
| 113 | 130 | |
| 131 | + // Constrain the border's orientation to the orientation of item-view. | |
| 132 | + Constraint constraint = Constraint::New< Quaternion >( border, Actor::Property::ORIENTATION, EqualToConstraint() ); | |
| 133 | + constraint.AddSource( Source( mItemView, Actor::Property::ORIENTATION ) ); | |
| 134 | + constraint.Apply(); | |
| 135 | + | |
| 114 | 136 | // Create a button to toggle the clipping mode |
| 115 | 137 | PushButton button = Toolkit::PushButton::New(); |
| 116 | 138 | button.SetParentOrigin( ParentOrigin::BOTTOM_CENTER ); |
| ... | ... | @@ -118,14 +140,36 @@ private: |
| 118 | 140 | button.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); |
| 119 | 141 | button.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); |
| 120 | 142 | button.SetProperty( Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D ); |
| 121 | - button.SetProperty( Button::Property::LABEL, | |
| 122 | - Property::Map().Add( Toolkit::Visual::Property::TYPE, Toolkit::DevelVisual::TEXT ) | |
| 123 | - .Add( Toolkit::TextVisual::Property::TEXT, BUTTON_LABEL ) ); | |
| 143 | + button.SetProperty( Button::Property::LABEL, BUTTON_LABEL ); | |
| 124 | 144 | button.ClickedSignal().Connect( this, &ClippingExample::OnButtonClicked ); |
| 125 | 145 | stage.Add( button ); |
| 126 | 146 | } |
| 127 | 147 | |
| 128 | 148 | /** |
| 149 | + * @brief Called when the item-view starts to scroll. | |
| 150 | + * | |
| 151 | + * Here we want to apply the item-view constraint. | |
| 152 | + */ | |
| 153 | + void ScrollStarted( const Vector2& /* currentScrollPosition */ ) | |
| 154 | + { | |
| 155 | + mItemViewOrientationConstraint.Apply(); | |
| 156 | + } | |
| 157 | + | |
| 158 | + /** | |
| 159 | + * @brief Called when the item-view scrolling completes. | |
| 160 | + * | |
| 161 | + * Here we remove the item-view orientation constraint and perform an animation to return the item-view back to base-rotation. | |
| 162 | + */ | |
| 163 | + void ScrollCompleted( const Vector2& /* currentScrollPosition */ ) | |
| 164 | + { | |
| 165 | + Animation animation = Animation::New( ITEM_VIEW_ROTATION_ANIMATION_TIME ); | |
| 166 | + animation.AnimateTo( Property( mItemView, Actor::Property::ORIENTATION ), Quaternion( Degree( 0.0f ), Vector3::XAXIS ), AlphaFunction::EASE_IN_SINE ); | |
| 167 | + animation.Play(); | |
| 168 | + | |
| 169 | + mItemViewOrientationConstraint.Remove(); | |
| 170 | + } | |
| 171 | + | |
| 172 | + /** | |
| 129 | 173 | * @brief Called when any key event is received |
| 130 | 174 | * |
| 131 | 175 | * Will use this to quit the application if Back or the Escape key is received |
| ... | ... | @@ -163,6 +207,7 @@ private: |
| 163 | 207 | Application& mApplication; ///< Reference to the application class. |
| 164 | 208 | ItemView mItemView; ///< The item view which whose children we would like to clip. |
| 165 | 209 | ClippingItemFactory mClippingItemFactory; ///< The ItemFactory used to create our items. |
| 210 | + Constraint mItemViewOrientationConstraint; ///< The constraint used to control the orientation of item-view. | |
| 166 | 211 | }; |
| 167 | 212 | |
| 168 | 213 | int DALI_EXPORT_API main( int argc, char **argv ) | ... | ... |
examples/clipping/item-view-orientation-constraint.h
0 โ 100644
| 1 | +#ifndef ITEM_VIEW_ORIENTATION_CONSTRAINT_H | |
| 2 | +#define ITEM_VIEW_ORIENTATION_CONSTRAINT_H | |
| 3 | + | |
| 4 | +/* | |
| 5 | + * Copyright (c) 2017 Samsung Electronics Co., Ltd. | |
| 6 | + * | |
| 7 | + * Licensed under the Apache License, Version 2.0 (the "License"); | |
| 8 | + * you may not use this file except in compliance with the License. | |
| 9 | + * You may obtain a copy of the License at | |
| 10 | + * | |
| 11 | + * http://www.apache.org/licenses/LICENSE-2.0 | |
| 12 | + * | |
| 13 | + * Unless required by applicable law or agreed to in writing, software | |
| 14 | + * distributed under the License is distributed on an "AS IS" BASIS, | |
| 15 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 16 | + * See the License for the specific language governing permissions and | |
| 17 | + * limitations under the License. | |
| 18 | + * | |
| 19 | + */ | |
| 20 | + | |
| 21 | +// EXTERNAL INCLUDES | |
| 22 | +#include <dali/public-api/animation/constraint.h> | |
| 23 | +#include <dali/public-api/math/degree.h> | |
| 24 | +#include <dali/public-api/math/math-utils.h> | |
| 25 | +#include <dali/public-api/math/quaternion.h> | |
| 26 | +#include <dali/public-api/math/radian.h> | |
| 27 | +#include <dali/public-api/math/vector3.h> | |
| 28 | + | |
| 29 | +/** | |
| 30 | + * @brief Constraint used to constrain the orientation of the item-view depending on the position within the layout. | |
| 31 | + */ | |
| 32 | +class ItemViewOrientationConstraint | |
| 33 | +{ | |
| 34 | +public: | |
| 35 | + | |
| 36 | + /** | |
| 37 | + * @brief Constructor. | |
| 38 | + * @param[in] maximumRotationInDegrees The maximum rotation (in degrees) that we should rotate the item-view by. | |
| 39 | + * @param[in] layoutPositionChangeMultiplier This value is used to multiply the change in layout position | |
| 40 | + * (in order to exaggerate the amount moved so it's more visible). | |
| 41 | + */ | |
| 42 | + ItemViewOrientationConstraint( float maximumRotationInDegrees, float layoutPositionChangeMultiplier ) | |
| 43 | + : mMaximumRotationInDegrees( maximumRotationInDegrees ), | |
| 44 | + mLayoutPositionChangeMultiplier( layoutPositionChangeMultiplier ), | |
| 45 | + mStartingLayoutPosition( 0.0f ), | |
| 46 | + mStartingAngle( 0.0f ), | |
| 47 | + mFirstCall( true ) | |
| 48 | + { | |
| 49 | + } | |
| 50 | + | |
| 51 | + /** | |
| 52 | + * @brief Will be called by the Constraint. | |
| 53 | + * | |
| 54 | + * The first time this operator is called, it uses the values as it's base reference. | |
| 55 | + * Thereafter, the position in the layout is used to determine the rotation around the X-Axis. | |
| 56 | + * | |
| 57 | + * @param[in] rotation The rotation of the item-view. | |
| 58 | + * @param[in] inputs The constraint inputs: | |
| 59 | + * [0] ItemView::Property::LAYOUT_POSITION, float | |
| 60 | + */ | |
| 61 | + void operator()( Dali::Quaternion& rotation, const Dali::PropertyInputContainer& inputs ) | |
| 62 | + { | |
| 63 | + const float& layoutPosition = inputs[ 0 ]->GetFloat(); | |
| 64 | + | |
| 65 | + // Store values for base reference when called the first call. | |
| 66 | + if( mFirstCall ) | |
| 67 | + { | |
| 68 | + mStartingLayoutPosition = layoutPosition; | |
| 69 | + | |
| 70 | + Dali::Vector3 axis; | |
| 71 | + Dali::Radian angleInRadians; | |
| 72 | + rotation.ToAxisAngle( axis, angleInRadians ); | |
| 73 | + Dali::Degree angleInDegrees( angleInRadians ); // Convert to Degrees | |
| 74 | + | |
| 75 | + mStartingAngle = angleInDegrees.degree; | |
| 76 | + if( axis.x < 0.0f ) // We only rotate round the X-Axis. So if the X-Axis is negative, then the angle is also a negative angle. | |
| 77 | + { | |
| 78 | + mStartingAngle = -mStartingAngle; | |
| 79 | + } | |
| 80 | + | |
| 81 | + mFirstCall = false; | |
| 82 | + } | |
| 83 | + else | |
| 84 | + { | |
| 85 | + // All subsequent calls should tilt the orientation of the item-view around the X-Axis depending on how much our position has changed in the layout. | |
| 86 | + | |
| 87 | + Dali::Degree angle( mStartingAngle + mLayoutPositionChangeMultiplier * ( mStartingLayoutPosition - layoutPosition ) ); | |
| 88 | + Dali::ClampInPlace( angle.degree, -mMaximumRotationInDegrees, mMaximumRotationInDegrees ); // Ensure the angle does not exceed maximum specified (in both directions). | |
| 89 | + rotation = Dali::Quaternion( angle, Dali::Vector3::XAXIS ); | |
| 90 | + } | |
| 91 | + } | |
| 92 | + | |
| 93 | +private: | |
| 94 | + | |
| 95 | + const float mMaximumRotationInDegrees; ///< The maximum allowable rotation of the item-view. | |
| 96 | + const float mLayoutPositionChangeMultiplier; ///< This value is used to multiply the change in layout position. | |
| 97 | + float mStartingLayoutPosition; ///< The starting layout position. | |
| 98 | + float mStartingAngle; ///< The starting angle (in degrees) of the item-view. | |
| 99 | + bool mFirstCall; ///< A boolean to state whether this is the first time the operator() is called. Allows us to set the starting values. | |
| 100 | +}; | |
| 101 | + | |
| 102 | +#endif // ITEM_VIEW_ORIENTATION_CONSTRAINT_H | ... | ... |
examples/styling/image-channel-control-impl.cpp
| ... | ... | @@ -37,11 +37,12 @@ const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER( |
| 37 | 37 | varying mediump vec2 vTexCoord;\n |
| 38 | 38 | uniform sampler2D sTexture;\n |
| 39 | 39 | uniform mediump vec4 uColor;\n |
| 40 | + uniform mediump vec4 mixColor;\n | |
| 40 | 41 | uniform mediump vec3 uChannels;\n |
| 41 | 42 | \n |
| 42 | 43 | void main()\n |
| 43 | 44 | {\n |
| 44 | - gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor * vec4(uChannels, 1.0) ;\n | |
| 45 | + gl_FragColor = texture2D( sTexture, vTexCoord ) * mixColor * uColor * vec4(uChannels, 1.0) ;\n | |
| 45 | 46 | }\n |
| 46 | 47 | ); |
| 47 | 48 | ... | ... |
examples/styling/styling-application.cpp
| ... | ... | @@ -24,8 +24,9 @@ |
| 24 | 24 | |
| 25 | 25 | // External includes |
| 26 | 26 | #include <dali-toolkit/dali-toolkit.h> |
| 27 | -//#include <dali-toolkit/devel-api/controls/slider/slider.h> | |
| 28 | 27 | #include <dali-toolkit/devel-api/controls/popup/popup.h> |
| 28 | +#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h> | |
| 29 | +#include <dali-toolkit/devel-api/visuals/text-visual-properties.h> | |
| 29 | 30 | #include "image-channel-control.h" |
| 30 | 31 | #include <cstdio> |
| 31 | 32 | #include <sstream> |
| ... | ... | @@ -212,7 +213,7 @@ void StylingApplication::Create( Application& application ) |
| 212 | 213 | mIcc1.SetSizeScalePolicy( SizeScalePolicy::FIT_WITH_ASPECT_RATIO ); |
| 213 | 214 | mIcc1.SetParentOrigin( ParentOrigin::CENTER ); |
| 214 | 215 | mIcc1.SetVisibility( true ); |
| 215 | - | |
| 216 | + | |
| 216 | 217 | mImagePlacement.Add( mIcc1 ); |
| 217 | 218 | |
| 218 | 219 | mIcc2 = ImageChannelControl::New( BIG_IMAGE_2 ); |
| ... | ... | @@ -484,20 +485,20 @@ bool StylingApplication::OnButtonStateChange( Button button ) |
| 484 | 485 | |
| 485 | 486 | // Todo: save / restore slider states per image |
| 486 | 487 | |
| 487 | - if( button.GetProperty( Toolkit::Button::Property::SELECTED ).Get<bool>() ) | |
| 488 | + if( button.GetProperty<bool>(Button::Property::SELECTED) ) | |
| 488 | 489 | { |
| 489 | 490 | |
| 490 | 491 | ImageChannelControl prevIcc = mImageChannelControl; |
| 491 | 492 | |
| 492 | - if( mRadioButtons[0].GetProperty( Toolkit::Button::Property::SELECTED ).Get<bool>() ) | |
| 493 | + if( mRadioButtons[0].GetProperty<bool>(Button::Property::SELECTED) ) | |
| 493 | 494 | { |
| 494 | 495 | mImageChannelControl = mIcc1; |
| 495 | 496 | } |
| 496 | - else if( mRadioButtons[1].GetProperty( Toolkit::Button::Property::SELECTED ).Get<bool>() ) | |
| 497 | + else if( mRadioButtons[1].GetProperty<bool>(Button::Property::SELECTED) ) | |
| 497 | 498 | { |
| 498 | 499 | mImageChannelControl = mIcc2; |
| 499 | 500 | } |
| 500 | - else if( mRadioButtons[2].GetProperty( Toolkit::Button::Property::SELECTED ).Get<bool>() ) | |
| 501 | + else if( mRadioButtons[2].GetProperty<bool>(Button::Property::SELECTED) ) | |
| 501 | 502 | { |
| 502 | 503 | mImageChannelControl = mIcc3; |
| 503 | 504 | } |
| ... | ... | @@ -523,7 +524,7 @@ bool StylingApplication::OnCheckButtonChange( Button button ) |
| 523 | 524 | { |
| 524 | 525 | int channel = button.GetProperty<int>( index ); |
| 525 | 526 | float value = mChannelSliders[channel].GetProperty<float>( Slider::Property::VALUE ); |
| 526 | - if( !button.IsSelected() ) | |
| 527 | + if( !button.GetProperty<bool>(Button::Property::SELECTED) ) | |
| 527 | 528 | { |
| 528 | 529 | // "Turn off" the channel's contribution |
| 529 | 530 | value = 0.0f; |
| ... | ... | @@ -600,7 +601,7 @@ bool StylingApplication::OnSliderChanged( Slider slider, float value ) |
| 600 | 601 | if( index != Property::INVALID_INDEX ) |
| 601 | 602 | { |
| 602 | 603 | int channel = slider.GetProperty<int>( index ); |
| 603 | - if( mCheckButtons[channel].IsSelected() ) | |
| 604 | + if( mCheckButtons[channel].GetProperty<bool>(Button::Property::SELECTED) ) | |
| 604 | 605 | { |
| 605 | 606 | Property::Index channelIndex = GetChannelProperty( channel ); |
| 606 | 607 | mImageChannelControl.SetProperty(channelIndex, value/100.0f); | ... | ... |
examples/transitions/beat-control-impl.cpp 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 | -#include "beat-control-impl.h" | |
| 18 | -#include <dali-toolkit/dali-toolkit.h> | |
| 19 | -#include <dali/public-api/object/type-registry-helper.h> | |
| 20 | -#include <dali-toolkit/devel-api/align-enums.h> | |
| 21 | -#include <dali-toolkit/devel-api/visual-factory/visual-factory.h> | |
| 22 | -#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h> | |
| 23 | - | |
| 24 | -#include <cstdio> | |
| 25 | - | |
| 26 | -using namespace Dali; // Needed for macros | |
| 27 | -using namespace Dali::Toolkit; | |
| 28 | - | |
| 29 | -namespace Demo | |
| 30 | -{ | |
| 31 | -namespace Internal | |
| 32 | -{ | |
| 33 | - | |
| 34 | -namespace | |
| 35 | -{ | |
| 36 | - | |
| 37 | - | |
| 38 | -Dali::BaseHandle Create() | |
| 39 | -{ | |
| 40 | - return Demo::BeatControl::New(); | |
| 41 | -} | |
| 42 | - | |
| 43 | -DALI_TYPE_REGISTRATION_BEGIN( BeatControl, Dali::Toolkit::Control, Create ); | |
| 44 | - | |
| 45 | -DALI_PROPERTY_REGISTRATION( Demo, BeatControl, "bounceTransition", STRING, BOUNCE_TRANSITION ); | |
| 46 | -DALI_PROPERTY_REGISTRATION( Demo, BeatControl, "leftTransition", STRING, LEFT_TRANSITION ); | |
| 47 | -DALI_PROPERTY_REGISTRATION( Demo, BeatControl, "upTransition", STRING, UP_TRANSITION ); | |
| 48 | -DALI_PROPERTY_REGISTRATION( Demo, BeatControl, "beatVisual", MAP, BEAT_VISUAL ); | |
| 49 | -DALI_TYPE_REGISTRATION_END(); | |
| 50 | - | |
| 51 | - | |
| 52 | -Toolkit::TransitionData ConvertPropertyToTransition( const Property::Value& value ) | |
| 53 | -{ | |
| 54 | - Toolkit::TransitionData transitionData; | |
| 55 | - | |
| 56 | - if( value.GetType() == Property::ARRAY ) | |
| 57 | - { | |
| 58 | - transitionData = Toolkit::TransitionData::New( *value.GetArray()); | |
| 59 | - } | |
| 60 | - else if( value.GetType() == Property::MAP ) | |
| 61 | - { | |
| 62 | - transitionData = Toolkit::TransitionData::New( *value.GetMap() ); | |
| 63 | - } | |
| 64 | - return transitionData; | |
| 65 | -} | |
| 66 | - | |
| 67 | -} // anonymous namespace | |
| 68 | - | |
| 69 | - | |
| 70 | -Internal::BeatControl::BeatControl() | |
| 71 | -: Control( ControlBehaviour( REQUIRES_STYLE_CHANGE_SIGNALS ) ) | |
| 72 | -{ | |
| 73 | -} | |
| 74 | - | |
| 75 | -Internal::BeatControl::~BeatControl() | |
| 76 | -{ | |
| 77 | -} | |
| 78 | - | |
| 79 | -Demo::BeatControl Internal::BeatControl::New() | |
| 80 | -{ | |
| 81 | - IntrusivePtr<Internal::BeatControl> impl = new Internal::BeatControl(); | |
| 82 | - Demo::BeatControl handle = Demo::BeatControl( *impl ); | |
| 83 | - impl->Initialize(); | |
| 84 | - return handle; | |
| 85 | -} | |
| 86 | - | |
| 87 | - | |
| 88 | -void BeatControl::StartBounceAnimation() | |
| 89 | -{ | |
| 90 | - if( mAnimation ) | |
| 91 | - { | |
| 92 | - mAnimation.Stop(); | |
| 93 | - mAnimation.FinishedSignal().Disconnect( this, &BeatControl::OnBounceAnimationFinished ); | |
| 94 | - OnBounceAnimationFinished(mAnimation); | |
| 95 | - } | |
| 96 | - | |
| 97 | - mAnimation = CreateTransition( mBounceTransition ); | |
| 98 | - mAnimation.FinishedSignal().Connect( this, &BeatControl::OnBounceAnimationFinished ); | |
| 99 | - mAnimation.Play(); | |
| 100 | -} | |
| 101 | - | |
| 102 | - | |
| 103 | -void BeatControl::StartXAnimation() | |
| 104 | -{ | |
| 105 | - if( mXAnimation ) | |
| 106 | - { | |
| 107 | - mXAnimation.Stop(); | |
| 108 | - mXAnimation.FinishedSignal().Disconnect( this, &BeatControl::OnXAnimationFinished ); | |
| 109 | - OnXAnimationFinished(mXAnimation); | |
| 110 | - } | |
| 111 | - | |
| 112 | - mXAnimation = CreateTransition( mLeftTransition ); | |
| 113 | - mXAnimation.FinishedSignal().Connect( this, &BeatControl::OnXAnimationFinished ); | |
| 114 | - mXAnimation.Play(); | |
| 115 | -} | |
| 116 | - | |
| 117 | -void BeatControl::StartYAnimation() | |
| 118 | -{ | |
| 119 | - if( mYAnimation ) | |
| 120 | - { | |
| 121 | - mYAnimation.Stop(); | |
| 122 | - mYAnimation.FinishedSignal().Disconnect( this, &BeatControl::OnYAnimationFinished ); | |
| 123 | - OnYAnimationFinished(mYAnimation); | |
| 124 | - } | |
| 125 | - | |
| 126 | - mYAnimation = CreateTransition( mUpTransition ); | |
| 127 | - mYAnimation.FinishedSignal().Connect( this, &BeatControl::OnYAnimationFinished ); | |
| 128 | - mYAnimation.Play(); | |
| 129 | -} | |
| 130 | - | |
| 131 | - | |
| 132 | -void BeatControl::OnBounceAnimationFinished( Animation& src ) | |
| 133 | -{ | |
| 134 | - // Do stuff | |
| 135 | -} | |
| 136 | -void BeatControl::OnXAnimationFinished( Animation& src ) | |
| 137 | -{ | |
| 138 | - // Do stuff | |
| 139 | -} | |
| 140 | -void BeatControl::OnYAnimationFinished( Animation& src ) | |
| 141 | -{ | |
| 142 | - // Do stuff | |
| 143 | -} | |
| 144 | - | |
| 145 | -void BeatControl::OnInitialize() | |
| 146 | -{ | |
| 147 | - Actor self = Self(); | |
| 148 | -} | |
| 149 | - | |
| 150 | -void BeatControl::OnStageConnection( int depth ) | |
| 151 | -{ | |
| 152 | - Control::OnStageConnection( depth ); | |
| 153 | -} | |
| 154 | - | |
| 155 | -void BeatControl::OnStageDisconnection() | |
| 156 | -{ | |
| 157 | - Control::OnStageDisconnection(); | |
| 158 | -} | |
| 159 | - | |
| 160 | -void BeatControl::OnSizeSet( const Vector3& targetSize ) | |
| 161 | -{ | |
| 162 | - Control::OnSizeSet( targetSize ); | |
| 163 | - RelayoutVisuals( Vector2( targetSize ) ); | |
| 164 | -} | |
| 165 | - | |
| 166 | -void BeatControl::OnRelayout( const Vector2& targetSize, RelayoutContainer& container ) | |
| 167 | -{ | |
| 168 | - RelayoutVisuals( targetSize ); | |
| 169 | -} | |
| 170 | - | |
| 171 | -void BeatControl::RelayoutVisuals( const Vector2& targetSize ) | |
| 172 | -{ | |
| 173 | - if( mVisual ) | |
| 174 | - { | |
| 175 | - Vector2 size( targetSize ); | |
| 176 | - Property::Map transformMap; | |
| 177 | - // Make the visual half the size of the control, but leave | |
| 178 | - // origin and anchor point at center, position is relative, but Zer0 | |
| 179 | - transformMap[ DevelVisual::Transform::Property::SIZE ] = Vector2(0.5, 0.5); | |
| 180 | - mVisual.SetTransformAndSize( transformMap, size ); | |
| 181 | - | |
| 182 | - // @todo We must stop this clashing with a transform animation | |
| 183 | - } | |
| 184 | -} | |
| 185 | - | |
| 186 | -Vector3 BeatControl::GetNaturalSize() | |
| 187 | -{ | |
| 188 | - if( mVisual ) | |
| 189 | - { | |
| 190 | - Vector2 naturalSize; | |
| 191 | - mVisual.GetNaturalSize(naturalSize); | |
| 192 | - return Vector3(naturalSize); | |
| 193 | - } | |
| 194 | - return Vector3::ZERO; | |
| 195 | -} | |
| 196 | - | |
| 197 | -void BeatControl::OnStyleChange( Toolkit::StyleManager styleManager, StyleChange::Type change ) | |
| 198 | -{ | |
| 199 | - // Chain up. | |
| 200 | - Control::OnStyleChange( styleManager, change ); | |
| 201 | -} | |
| 202 | - | |
| 203 | - | |
| 204 | -/////////////////////////////////////////////////////////// | |
| 205 | -// | |
| 206 | -// Properties | |
| 207 | -// | |
| 208 | - | |
| 209 | -void BeatControl::SetProperty( BaseObject* object, Property::Index index, const Property::Value& value ) | |
| 210 | -{ | |
| 211 | - Demo::BeatControl beatControl = Demo::BeatControl::DownCast( Dali::BaseHandle( object ) ); | |
| 212 | - | |
| 213 | - if( beatControl ) | |
| 214 | - { | |
| 215 | - BeatControl& impl = GetImpl( beatControl ); | |
| 216 | - Actor self = impl.Self(); | |
| 217 | - switch ( index ) | |
| 218 | - { | |
| 219 | - case Demo::BeatControl::Property::BEAT_VISUAL: | |
| 220 | - { | |
| 221 | - Property::Map* map = value.GetMap(); | |
| 222 | - if( map ) | |
| 223 | - { | |
| 224 | - impl.mVisual = Toolkit::VisualFactory::Get().CreateVisual( *map ); | |
| 225 | - impl.RegisterVisual( Demo::BeatControl::Property::BEAT_VISUAL, impl.mVisual ); | |
| 226 | - } | |
| 227 | - break; | |
| 228 | - } | |
| 229 | - case Demo::BeatControl::Property::BOUNCE_TRANSITION: | |
| 230 | - { | |
| 231 | - impl.mBounceTransition = ConvertPropertyToTransition( value ); | |
| 232 | - break; | |
| 233 | - } | |
| 234 | - case Demo::BeatControl::Property::LEFT_TRANSITION: | |
| 235 | - { | |
| 236 | - impl.mLeftTransition = ConvertPropertyToTransition( value ); | |
| 237 | - break; | |
| 238 | - } | |
| 239 | - case Demo::BeatControl::Property::UP_TRANSITION: | |
| 240 | - { | |
| 241 | - impl.mUpTransition = ConvertPropertyToTransition( value ); | |
| 242 | - break; | |
| 243 | - } | |
| 244 | - } | |
| 245 | - } | |
| 246 | -} | |
| 247 | - | |
| 248 | -Property::Value BeatControl::GetProperty( BaseObject* object, Property::Index propertyIndex ) | |
| 249 | -{ | |
| 250 | - Property::Value value; | |
| 251 | - | |
| 252 | - Demo::BeatControl beatControl = Demo::BeatControl::DownCast( Dali::BaseHandle( object ) ); | |
| 253 | - | |
| 254 | - if ( beatControl ) | |
| 255 | - { | |
| 256 | - BeatControl& impl = GetImpl( beatControl ); | |
| 257 | - switch ( propertyIndex ) | |
| 258 | - { | |
| 259 | - case Demo::BeatControl::Property::BEAT_VISUAL: | |
| 260 | - { | |
| 261 | - if( impl.mVisual ) | |
| 262 | - { | |
| 263 | - Property::Map map; | |
| 264 | - impl.mVisual.CreatePropertyMap(map); | |
| 265 | - value = map; | |
| 266 | - } | |
| 267 | - break; | |
| 268 | - } | |
| 269 | - case Demo::BeatControl::Property::BOUNCE_TRANSITION: | |
| 270 | - default: | |
| 271 | - break; | |
| 272 | - } | |
| 273 | - } | |
| 274 | - | |
| 275 | - return value; | |
| 276 | -} | |
| 277 | - | |
| 278 | - | |
| 279 | -} // Internal | |
| 280 | -} // Demo |
examples/transitions/shadow-button-impl.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 "shadow-button-impl.h" | |
| 18 | +#include <dali-toolkit/dali-toolkit.h> | |
| 19 | +#include <dali/public-api/object/type-registry-helper.h> | |
| 20 | +#include <dali/devel-api/scripting/enum-helper.h> | |
| 21 | +#include <dali-toolkit/devel-api/align-enums.h> | |
| 22 | +#include <dali-toolkit/devel-api/visual-factory/visual-factory.h> | |
| 23 | +#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h> | |
| 24 | + | |
| 25 | +#include <cstdio> | |
| 26 | + | |
| 27 | +using namespace Dali; // Needed for macros | |
| 28 | +using namespace Dali::Toolkit; | |
| 29 | + | |
| 30 | +namespace Demo | |
| 31 | +{ | |
| 32 | +namespace Internal | |
| 33 | +{ | |
| 34 | + | |
| 35 | +namespace | |
| 36 | +{ | |
| 37 | + | |
| 38 | + | |
| 39 | +Dali::BaseHandle Create() | |
| 40 | +{ | |
| 41 | + return Demo::ShadowButton::New(); | |
| 42 | +} | |
| 43 | + | |
| 44 | +DALI_TYPE_REGISTRATION_BEGIN( ShadowButton, Dali::Toolkit::Button, Create ); | |
| 45 | + | |
| 46 | +DALI_PROPERTY_REGISTRATION( Demo, ShadowButton, "activeTransition", ARRAY, ACTIVE_TRANSITION ); | |
| 47 | +DALI_PROPERTY_REGISTRATION( Demo, ShadowButton, "inactiveTransition", ARRAY, INACTIVE_TRANSITION ); | |
| 48 | +DALI_PROPERTY_REGISTRATION( Demo, ShadowButton, "checkTransition", ARRAY, CHECK_TRANSITION ); | |
| 49 | +DALI_PROPERTY_REGISTRATION( Demo, ShadowButton, "uncheckTransition", ARRAY, UNCHECK_TRANSITION ); | |
| 50 | +DALI_PROPERTY_REGISTRATION( Demo, ShadowButton, "backgroundVisual", MAP, BACKGROUND_VISUAL ); | |
| 51 | +DALI_PROPERTY_REGISTRATION( Demo, ShadowButton, "checkboxBgVisual", MAP, CHECKBOX_BG_VISUAL ); | |
| 52 | +DALI_PROPERTY_REGISTRATION( Demo, ShadowButton, "checkboxFgVisual", MAP, CHECKBOX_FG_VISUAL ); | |
| 53 | +DALI_PROPERTY_REGISTRATION( Demo, ShadowButton, "labelVisual", MAP, LABEL_VISUAL ); | |
| 54 | +DALI_PROPERTY_REGISTRATION( Demo, ShadowButton, "checkState", BOOLEAN, ACTIVE_STATE ); | |
| 55 | +DALI_PROPERTY_REGISTRATION( Demo, ShadowButton, "checkState", BOOLEAN, CHECK_STATE ); | |
| 56 | + | |
| 57 | +DALI_TYPE_REGISTRATION_END(); | |
| 58 | + | |
| 59 | +DALI_ENUM_TO_STRING_TABLE_BEGIN( VISUAL_PROPERTIES ) | |
| 60 | +{ "backgroundVisual", Demo::ShadowButton::Property::BACKGROUND_VISUAL }, | |
| 61 | +{ "checkboxBgVisual", Demo::ShadowButton::Property::CHECKBOX_BG_VISUAL}, | |
| 62 | +{ "checkboxFgVisual", Demo::ShadowButton::Property::CHECKBOX_FG_VISUAL}, | |
| 63 | +{ "labelVisual", Demo::ShadowButton::Property::LABEL_VISUAL} | |
| 64 | +DALI_ENUM_TO_STRING_TABLE_END( VISUAL_PROPERTIES ) | |
| 65 | + | |
| 66 | +Toolkit::TransitionData ConvertPropertyToTransition( const Property::Value& value ) | |
| 67 | +{ | |
| 68 | + Toolkit::TransitionData transitionData; | |
| 69 | + | |
| 70 | + if( value.GetType() == Property::ARRAY ) | |
| 71 | + { | |
| 72 | + transitionData = Toolkit::TransitionData::New( *value.GetArray()); | |
| 73 | + } | |
| 74 | + else if( value.GetType() == Property::MAP ) | |
| 75 | + { | |
| 76 | + transitionData = Toolkit::TransitionData::New( *value.GetMap() ); | |
| 77 | + } | |
| 78 | + return transitionData; | |
| 79 | +} | |
| 80 | + | |
| 81 | +} // anonymous namespace | |
| 82 | + | |
| 83 | + | |
| 84 | +Internal::ShadowButton::ShadowButton() | |
| 85 | +: Control( ControlBehaviour( REQUIRES_STYLE_CHANGE_SIGNALS ) ), | |
| 86 | + mCheckState(false), | |
| 87 | + mActiveState(false) | |
| 88 | +{ | |
| 89 | +} | |
| 90 | + | |
| 91 | +Internal::ShadowButton::~ShadowButton() | |
| 92 | +{ | |
| 93 | +} | |
| 94 | + | |
| 95 | +Demo::ShadowButton Internal::ShadowButton::New() | |
| 96 | +{ | |
| 97 | + IntrusivePtr<Internal::ShadowButton> impl = new Internal::ShadowButton(); | |
| 98 | + Demo::ShadowButton handle = Demo::ShadowButton( *impl ); | |
| 99 | + impl->Initialize(); | |
| 100 | + return handle; | |
| 101 | +} | |
| 102 | + | |
| 103 | +void ShadowButton::SetActiveState( bool active ) | |
| 104 | +{ | |
| 105 | + if( active != mActiveState ) | |
| 106 | + { | |
| 107 | + mActiveState = active; | |
| 108 | + if( active ) | |
| 109 | + { | |
| 110 | + StartTransition( Demo::ShadowButton::Property::ACTIVE_TRANSITION ); | |
| 111 | + } | |
| 112 | + else | |
| 113 | + { | |
| 114 | + StartTransition( Demo::ShadowButton::Property::INACTIVE_TRANSITION ); | |
| 115 | + } | |
| 116 | + } | |
| 117 | +} | |
| 118 | + | |
| 119 | +bool ShadowButton::GetActiveState() | |
| 120 | +{ | |
| 121 | + return mActiveState; | |
| 122 | +} | |
| 123 | + | |
| 124 | +void ShadowButton::SetCheckState( bool checkState ) | |
| 125 | +{ | |
| 126 | + mCheckState = checkState; | |
| 127 | + EnableVisual( Demo::ShadowButton::Property::CHECKBOX_FG_VISUAL, true ); | |
| 128 | + if( Self().OnStage() ) | |
| 129 | + { | |
| 130 | + if( checkState ) | |
| 131 | + { | |
| 132 | + StartTransition( Demo::ShadowButton::Property::CHECK_TRANSITION ); | |
| 133 | + } | |
| 134 | + else | |
| 135 | + { | |
| 136 | + StartTransition( Demo::ShadowButton::Property::UNCHECK_TRANSITION ); | |
| 137 | + } | |
| 138 | + } | |
| 139 | + RelayoutRequest(); | |
| 140 | +} | |
| 141 | + | |
| 142 | +bool ShadowButton::GetCheckState() | |
| 143 | +{ | |
| 144 | + return mCheckState; | |
| 145 | +} | |
| 146 | + | |
| 147 | +void ShadowButton::StartTransition( Property::Index transitionId ) | |
| 148 | +{ | |
| 149 | + Transitions::iterator iter = FindTransition( transitionId ); | |
| 150 | + if( iter != mTransitions.end() ) | |
| 151 | + { | |
| 152 | + if( iter->mAnimation ) | |
| 153 | + { | |
| 154 | + iter->mAnimation.Stop(); | |
| 155 | + iter->mPlaying = false; | |
| 156 | + | |
| 157 | + iter->mAnimation.FinishedSignal().Disconnect( this, &ShadowButton::OnTransitionFinished ); | |
| 158 | + } | |
| 159 | + | |
| 160 | + iter->mAnimation = CreateTransition( iter->mTransitionData ); | |
| 161 | + StoreTargetLayouts( iter->mTransitionData ); | |
| 162 | + | |
| 163 | + iter->mAnimation.FinishedSignal().Connect( this, &ShadowButton::OnTransitionFinished ); | |
| 164 | + iter->mAnimation.Play(); | |
| 165 | + iter->mPlaying = true; | |
| 166 | + } | |
| 167 | +} | |
| 168 | + | |
| 169 | +void ShadowButton::OnTransitionFinished( Animation& src ) | |
| 170 | +{ | |
| 171 | + ShadowButton::Transitions::iterator iter = mTransitions.begin(); | |
| 172 | + for( ; iter != mTransitions.end(); ++iter ) | |
| 173 | + { | |
| 174 | + if( iter->mAnimation == src ) | |
| 175 | + { | |
| 176 | + iter->mPlaying = false; | |
| 177 | + iter->mAnimation.Reset(); // Remove the animation when it's finished. | |
| 178 | + switch( iter->mTransitionId ) | |
| 179 | + { | |
| 180 | + case Demo::ShadowButton::Property::ACTIVE_TRANSITION: | |
| 181 | + { | |
| 182 | + // Consider relayouting the text. | |
| 183 | + break; | |
| 184 | + } | |
| 185 | + case Demo::ShadowButton::Property::INACTIVE_TRANSITION: | |
| 186 | + { | |
| 187 | + // Consider relayouting the text. | |
| 188 | + break; | |
| 189 | + } | |
| 190 | + case Demo::ShadowButton::Property::UNCHECK_TRANSITION: | |
| 191 | + { | |
| 192 | + EnableVisual( Demo::ShadowButton::Property::CHECKBOX_FG_VISUAL, false ); | |
| 193 | + break; | |
| 194 | + } | |
| 195 | + } | |
| 196 | + break; | |
| 197 | + } | |
| 198 | + } | |
| 199 | +} | |
| 200 | + | |
| 201 | +void ShadowButton::OnInitialize() | |
| 202 | +{ | |
| 203 | + Actor self = Self(); | |
| 204 | +} | |
| 205 | + | |
| 206 | +void ShadowButton::OnStageConnection( int depth ) | |
| 207 | +{ | |
| 208 | + Control::OnStageConnection( depth ); | |
| 209 | +} | |
| 210 | + | |
| 211 | +void ShadowButton::OnStageDisconnection() | |
| 212 | +{ | |
| 213 | + Control::OnStageDisconnection(); | |
| 214 | +} | |
| 215 | + | |
| 216 | +void ShadowButton::OnSizeSet( const Vector3& targetSize ) | |
| 217 | +{ | |
| 218 | + Control::OnSizeSet( targetSize ); | |
| 219 | + RelayoutVisuals( Vector2( targetSize ) ); | |
| 220 | +} | |
| 221 | + | |
| 222 | +void ShadowButton::OnRelayout( const Vector2& targetSize, RelayoutContainer& container ) | |
| 223 | +{ | |
| 224 | + RelayoutVisuals( targetSize ); | |
| 225 | +} | |
| 226 | + | |
| 227 | +void ShadowButton::RelayoutVisuals( const Vector2& targetSize ) | |
| 228 | +{ | |
| 229 | + bool transitioning = false; | |
| 230 | + ShadowButton::Transitions::iterator iter = mTransitions.begin(); | |
| 231 | + for( ; iter != mTransitions.end(); ++iter ) | |
| 232 | + { | |
| 233 | + if( iter->mPlaying == true ) | |
| 234 | + { | |
| 235 | + transitioning = true; | |
| 236 | + break; | |
| 237 | + } | |
| 238 | + } | |
| 239 | + | |
| 240 | + if( ! transitioning ) | |
| 241 | + { | |
| 242 | + for( ShadowButton::Transforms::iterator iter = mTransforms.begin(); | |
| 243 | + iter != mTransforms.end(); ++iter ) | |
| 244 | + { | |
| 245 | + switch( iter->mTransformId ) | |
| 246 | + { | |
| 247 | + case Demo::ShadowButton::Property::BACKGROUND_VISUAL: | |
| 248 | + { | |
| 249 | + mBackgroundVisual.SetTransformAndSize( iter->mTransform, targetSize ); | |
| 250 | + break; | |
| 251 | + } | |
| 252 | + case Demo::ShadowButton::Property::CHECKBOX_BG_VISUAL: | |
| 253 | + { | |
| 254 | + mCheckboxBgVisual.SetTransformAndSize( iter->mTransform, targetSize ); | |
| 255 | + break; | |
| 256 | + } | |
| 257 | + case Demo::ShadowButton::Property::CHECKBOX_FG_VISUAL: | |
| 258 | + { | |
| 259 | + mCheckboxFgVisual.SetTransformAndSize( iter->mTransform, targetSize ); | |
| 260 | + break; | |
| 261 | + } | |
| 262 | + case Demo::ShadowButton::Property::LABEL_VISUAL: | |
| 263 | + { | |
| 264 | + mLabelVisual.SetTransformAndSize( iter->mTransform, targetSize ); | |
| 265 | + break; | |
| 266 | + } | |
| 267 | + } | |
| 268 | + } | |
| 269 | + } | |
| 270 | +} | |
| 271 | + | |
| 272 | +Vector3 ShadowButton::GetNaturalSize() | |
| 273 | +{ | |
| 274 | + int width; | |
| 275 | + int height; | |
| 276 | + | |
| 277 | + Vector2 checkboxBgSize; | |
| 278 | + Vector2 checkboxFgSize; | |
| 279 | + Vector2 labelSize; | |
| 280 | + mCheckboxBgVisual.GetNaturalSize( checkboxBgSize ); | |
| 281 | + mCheckboxFgVisual.GetNaturalSize( checkboxFgSize ); | |
| 282 | + mLabelVisual.GetNaturalSize( labelSize ); | |
| 283 | + | |
| 284 | + width = std::max( checkboxBgSize.x, checkboxFgSize.x ) + labelSize.x; | |
| 285 | + height = std::max( std::max( checkboxFgSize.y, checkboxBgSize.y ), labelSize.y ); | |
| 286 | + | |
| 287 | + return Vector3( width, height, height ); | |
| 288 | +} | |
| 289 | + | |
| 290 | +void ShadowButton::OnStyleChange( Toolkit::StyleManager styleManager, StyleChange::Type change ) | |
| 291 | +{ | |
| 292 | + // Chain up. | |
| 293 | + Control::OnStyleChange( styleManager, change ); | |
| 294 | +} | |
| 295 | + | |
| 296 | +ShadowButton::Transitions::iterator ShadowButton::FindTransition( Property::Index index ) | |
| 297 | +{ | |
| 298 | + bool found = false; | |
| 299 | + ShadowButton::Transitions::iterator iter = mTransitions.begin(); | |
| 300 | + for( ; iter != mTransitions.end(); ++iter ) | |
| 301 | + { | |
| 302 | + if( iter->mTransitionId == index ) | |
| 303 | + { | |
| 304 | + found = true; | |
| 305 | + break; | |
| 306 | + } | |
| 307 | + } | |
| 308 | + if( ! found ) | |
| 309 | + { | |
| 310 | + iter = mTransitions.end(); | |
| 311 | + } | |
| 312 | + return iter; | |
| 313 | +} | |
| 314 | + | |
| 315 | +ShadowButton::Transforms::iterator ShadowButton::FindTransform( Property::Index index ) | |
| 316 | +{ | |
| 317 | + bool found = false; | |
| 318 | + ShadowButton::Transforms::iterator iter = mTransforms.begin(); | |
| 319 | + for( ; iter != mTransforms.end(); ++iter ) | |
| 320 | + { | |
| 321 | + if( iter->mTransformId == index ) | |
| 322 | + { | |
| 323 | + found = true; | |
| 324 | + break; | |
| 325 | + } | |
| 326 | + } | |
| 327 | + if( ! found ) | |
| 328 | + { | |
| 329 | + iter = mTransforms.end(); | |
| 330 | + } | |
| 331 | + return iter; | |
| 332 | +} | |
| 333 | + | |
| 334 | +void ShadowButton::ResetVisual( | |
| 335 | + Property::Index index, | |
| 336 | + Visual::Base& visual, | |
| 337 | + const Property::Value& value ) | |
| 338 | +{ | |
| 339 | + if( visual ) | |
| 340 | + { | |
| 341 | + // we are replacing an existing visual, so force relayout | |
| 342 | + RelayoutRequest(); | |
| 343 | + } | |
| 344 | + Property::Map* map = value.GetMap(); | |
| 345 | + if( map ) | |
| 346 | + { | |
| 347 | + visual = Toolkit::VisualFactory::Get().CreateVisual( *map ); | |
| 348 | + | |
| 349 | + // Set the appropriate depth index. | |
| 350 | + // @todo Should be able to set this from the style sheet | |
| 351 | + switch( index ) | |
| 352 | + { | |
| 353 | + case Demo::ShadowButton::Property::BACKGROUND_VISUAL: | |
| 354 | + { | |
| 355 | + RegisterVisual( index, visual ); | |
| 356 | + visual.SetDepthIndex(0.0f); | |
| 357 | + break; | |
| 358 | + } | |
| 359 | + case Demo::ShadowButton::Property::CHECKBOX_BG_VISUAL: | |
| 360 | + { | |
| 361 | + RegisterVisual( index, visual ); | |
| 362 | + visual.SetDepthIndex(1.0f); | |
| 363 | + break; | |
| 364 | + } | |
| 365 | + case Demo::ShadowButton::Property::CHECKBOX_FG_VISUAL: | |
| 366 | + { | |
| 367 | + RegisterVisual( index, visual, mCheckState ); | |
| 368 | + visual.SetDepthIndex(2.0f); | |
| 369 | + break; | |
| 370 | + } | |
| 371 | + case Demo::ShadowButton::Property::LABEL_VISUAL: | |
| 372 | + { | |
| 373 | + RegisterVisual( index, visual ); | |
| 374 | + visual.SetDepthIndex(1.0f); | |
| 375 | + break; | |
| 376 | + } | |
| 377 | + } | |
| 378 | + | |
| 379 | + // Extract transform maps out of the visual definition and store them | |
| 380 | + Property::Value* value = map->Find( DevelVisual::Property::TRANSFORM, "transform"); | |
| 381 | + if( value ) | |
| 382 | + { | |
| 383 | + Property::Map* transformMap = value->GetMap(); | |
| 384 | + if( transformMap ) | |
| 385 | + { | |
| 386 | + ShadowButton::Transforms::iterator iter = FindTransform( index ); | |
| 387 | + if( iter != mTransforms.end() ) | |
| 388 | + { | |
| 389 | + iter->mTransform = *transformMap; | |
| 390 | + } | |
| 391 | + else | |
| 392 | + { | |
| 393 | + mTransforms.push_back( Transform( index, *transformMap ) ); | |
| 394 | + } | |
| 395 | + } | |
| 396 | + } | |
| 397 | + } | |
| 398 | +} | |
| 399 | + | |
| 400 | +bool IsTransformProperty( const std::string& property ) | |
| 401 | +{ | |
| 402 | + const char* transformProperties[]= { "size", "offset", "origin", "anchorPoint", "offsetSizeMode" }; | |
| 403 | + const int NUM_TRANSFORM_PROPERTIES = sizeof( transformProperties ) / sizeof( const char * ); | |
| 404 | + | |
| 405 | + bool found=false; | |
| 406 | + for( int i=0; i<NUM_TRANSFORM_PROPERTIES; ++i ) | |
| 407 | + { | |
| 408 | + if( property == transformProperties[i] ) | |
| 409 | + { | |
| 410 | + found = true; | |
| 411 | + break; | |
| 412 | + } | |
| 413 | + } | |
| 414 | + return found; | |
| 415 | +} | |
| 416 | + | |
| 417 | +void ShadowButton::StoreTargetLayouts( TransitionData transitionData ) | |
| 418 | +{ | |
| 419 | + // Pseudo code | |
| 420 | + // foreach animator in transitionData | |
| 421 | + // if animator{"property"} in [ "size", "offset", "origin", "anchorPoint", "offsetSizeMode" ] | |
| 422 | + // transforms{ animator{"target"} }->{animator{"property"}} = animator{"targetValue"} | |
| 423 | + | |
| 424 | + | |
| 425 | + for( unsigned int i=0; i < transitionData.Count(); ++i ) | |
| 426 | + { | |
| 427 | + Property::Map animator = transitionData.GetAnimatorAt(i); | |
| 428 | + Property::Value* target = animator.Find( "target" ); | |
| 429 | + if( target ) | |
| 430 | + { | |
| 431 | + // Convert to index | |
| 432 | + Property::Index index; | |
| 433 | + if( Scripting::GetEnumerationProperty( *target, VISUAL_PROPERTIES_TABLE, VISUAL_PROPERTIES_TABLE_COUNT, index ) ) | |
| 434 | + { | |
| 435 | + ShadowButton::Transforms::iterator iter = FindTransform( index ); | |
| 436 | + if( iter != mTransforms.end() ) | |
| 437 | + { | |
| 438 | + Property::Value* property = animator.Find( "property" ); | |
| 439 | + if( property ) | |
| 440 | + { | |
| 441 | + std::string propertyString; | |
| 442 | + property->Get(propertyString); | |
| 443 | + if( IsTransformProperty( propertyString ) ) | |
| 444 | + { | |
| 445 | + Property::Value* targetValue = animator.Find( "targetValue" ); | |
| 446 | + if( targetValue ) | |
| 447 | + { | |
| 448 | + iter->mTransform[ propertyString ] = *targetValue; | |
| 449 | + } | |
| 450 | + } | |
| 451 | + } | |
| 452 | + } | |
| 453 | + } | |
| 454 | + } | |
| 455 | + } | |
| 456 | +} | |
| 457 | + | |
| 458 | +void ShadowButton::ResetTransition( | |
| 459 | + Property::Index index, | |
| 460 | + const Property::Value& value) | |
| 461 | +{ | |
| 462 | + ShadowButton::Transitions::iterator iter = FindTransition( index ); | |
| 463 | + if( iter != mTransitions.end() ) | |
| 464 | + { | |
| 465 | + // Already exists | |
| 466 | + iter->mTransitionData = ConvertPropertyToTransition( value ); | |
| 467 | + iter->mAnimation.Stop(); | |
| 468 | + iter->mAnimation.Clear(); | |
| 469 | + } | |
| 470 | + else | |
| 471 | + { | |
| 472 | + mTransitions.push_back( Transition( index, ConvertPropertyToTransition( value ) ) ); | |
| 473 | + } | |
| 474 | +} | |
| 475 | + | |
| 476 | + | |
| 477 | +void ShadowButton::SetProperty( BaseObject* object, Property::Index index, const Property::Value& value ) | |
| 478 | +{ | |
| 479 | + Demo::ShadowButton shadowButton = Demo::ShadowButton::DownCast( Dali::BaseHandle( object ) ); | |
| 480 | + | |
| 481 | + if( shadowButton ) | |
| 482 | + { | |
| 483 | + ShadowButton& impl = GetImpl( shadowButton ); | |
| 484 | + switch ( index ) | |
| 485 | + { | |
| 486 | + case Demo::ShadowButton::Property::BACKGROUND_VISUAL: | |
| 487 | + { | |
| 488 | + impl.ResetVisual( index, impl.mBackgroundVisual, value ); | |
| 489 | + break; | |
| 490 | + } | |
| 491 | + case Demo::ShadowButton::Property::CHECKBOX_BG_VISUAL: | |
| 492 | + { | |
| 493 | + impl.ResetVisual( index, impl.mCheckboxBgVisual, value ); | |
| 494 | + break; | |
| 495 | + } | |
| 496 | + case Demo::ShadowButton::Property::CHECKBOX_FG_VISUAL: | |
| 497 | + { | |
| 498 | + impl.ResetVisual( index, impl.mCheckboxFgVisual, value ); | |
| 499 | + impl.EnableVisual( Demo::ShadowButton::Property::CHECKBOX_FG_VISUAL, impl.mCheckState ); | |
| 500 | + break; | |
| 501 | + } | |
| 502 | + case Demo::ShadowButton::Property::LABEL_VISUAL: | |
| 503 | + { | |
| 504 | + impl.ResetVisual( index, impl.mLabelVisual, value ); | |
| 505 | + break; | |
| 506 | + } | |
| 507 | + case Demo::ShadowButton::Property::ACTIVE_TRANSITION: | |
| 508 | + case Demo::ShadowButton::Property::INACTIVE_TRANSITION: | |
| 509 | + case Demo::ShadowButton::Property::CHECK_TRANSITION: | |
| 510 | + case Demo::ShadowButton::Property::UNCHECK_TRANSITION: | |
| 511 | + { | |
| 512 | + impl.ResetTransition( index, value ); | |
| 513 | + break; | |
| 514 | + } | |
| 515 | + } | |
| 516 | + } | |
| 517 | +} | |
| 518 | + | |
| 519 | +Property::Value ShadowButton::GetProperty( BaseObject* object, Property::Index propertyIndex ) | |
| 520 | +{ | |
| 521 | + Property::Value value; | |
| 522 | + | |
| 523 | + Demo::ShadowButton shadowButton = Demo::ShadowButton::DownCast( Dali::BaseHandle( object ) ); | |
| 524 | + | |
| 525 | + if ( shadowButton ) | |
| 526 | + { | |
| 527 | + ShadowButton& impl = GetImpl( shadowButton ); | |
| 528 | + switch ( propertyIndex ) | |
| 529 | + { | |
| 530 | + case Demo::ShadowButton::Property::BACKGROUND_VISUAL: | |
| 531 | + { | |
| 532 | + Property::Map map; | |
| 533 | + impl.mBackgroundVisual.CreatePropertyMap(map); | |
| 534 | + value = map; | |
| 535 | + break; | |
| 536 | + } | |
| 537 | + case Demo::ShadowButton::Property::CHECKBOX_BG_VISUAL: | |
| 538 | + { | |
| 539 | + Property::Map map; | |
| 540 | + impl.mCheckboxBgVisual.CreatePropertyMap(map); | |
| 541 | + value = map; | |
| 542 | + break; | |
| 543 | + } | |
| 544 | + case Demo::ShadowButton::Property::CHECKBOX_FG_VISUAL: | |
| 545 | + { | |
| 546 | + Property::Map map; | |
| 547 | + impl.mCheckboxFgVisual.CreatePropertyMap(map); | |
| 548 | + value = map; | |
| 549 | + break; | |
| 550 | + } | |
| 551 | + case Demo::ShadowButton::Property::LABEL_VISUAL: | |
| 552 | + { | |
| 553 | + Property::Map map; | |
| 554 | + impl.mLabelVisual.CreatePropertyMap(map); | |
| 555 | + value = map; | |
| 556 | + break; | |
| 557 | + } | |
| 558 | + | |
| 559 | + default: | |
| 560 | + break; | |
| 561 | + } | |
| 562 | + } | |
| 563 | + | |
| 564 | + return value; | |
| 565 | +} | |
| 566 | + | |
| 567 | + | |
| 568 | +} // Internal | |
| 569 | +} // Demo | ... | ... |
examples/transitions/beat-control-impl.h renamed to examples/transitions/shadow-button-impl.h
| 1 | -#ifndef DALI_DEMO_INTERNAL_BEAT_CONTROL_IMPL_H | |
| 2 | -#define DALI_DEMO_INTERNAL_BEAT_CONTROL_IMPL_H | |
| 1 | +#ifndef DALI_DEMO_INTERNAL_SHADOW_BUTTON_IMPL_H | |
| 2 | +#define DALI_DEMO_INTERNAL_SHADOW_BUTTON_IMPL_H | |
| 3 | 3 | |
| 4 | 4 | /* |
| 5 | - * Copyright (c) 2016 Samsung Electronics Co., Ltd. | |
| 5 | + * Copyright (c) 2017 Samsung Electronics Co., Ltd. | |
| 6 | 6 | * |
| 7 | 7 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 8 | 8 | * you may not use this file except in compliance with the License. |
| ... | ... | @@ -17,7 +17,7 @@ |
| 17 | 17 | * limitations under the License. |
| 18 | 18 | */ |
| 19 | 19 | |
| 20 | -#include "beat-control.h" | |
| 20 | +#include "shadow-button.h" | |
| 21 | 21 | #include <dali/public-api/animation/animation.h> |
| 22 | 22 | #include <dali-toolkit/public-api/controls/control-impl.h> |
| 23 | 23 | #include <dali-toolkit/devel-api/visual-factory/visual-base.h> |
| ... | ... | @@ -29,22 +29,42 @@ namespace Demo |
| 29 | 29 | namespace Internal // To use TypeRegistry, handle and body classes need the same name |
| 30 | 30 | { |
| 31 | 31 | |
| 32 | -class BeatControl : public Dali::Toolkit::Internal::Control | |
| 32 | +class ShadowButton : public Dali::Toolkit::Internal::Control | |
| 33 | 33 | { |
| 34 | 34 | public: |
| 35 | 35 | /** |
| 36 | - * Instantiate a new BeatControl object | |
| 36 | + * Instantiate a new ShadowButton object | |
| 37 | 37 | */ |
| 38 | - static Demo::BeatControl New(); | |
| 39 | - BeatControl(); | |
| 40 | - ~BeatControl(); | |
| 38 | + static Demo::ShadowButton New(); | |
| 39 | + ShadowButton(); | |
| 40 | + ~ShadowButton(); | |
| 41 | 41 | |
| 42 | 42 | public: // API |
| 43 | - void StartBounceAnimation(); | |
| 43 | + /** | |
| 44 | + * @brief Set the button to be active or inactive. | |
| 45 | + * | |
| 46 | + * The button will perform a transition if there is a state change. | |
| 47 | + * @param[in] active The active state | |
| 48 | + */ | |
| 49 | + void SetActiveState( bool active ); | |
| 50 | + | |
| 51 | + /** | |
| 52 | + * Get the active state | |
| 53 | + * @return the active state | |
| 54 | + */ | |
| 55 | + bool GetActiveState(); | |
| 44 | 56 | |
| 45 | - void StartXAnimation(); | |
| 57 | + /** | |
| 58 | + * Set the check state | |
| 59 | + * @param[in] checkState The state of the checkbox | |
| 60 | + */ | |
| 61 | + void SetCheckState( bool checkState ); | |
| 46 | 62 | |
| 47 | - void StartYAnimation(); | |
| 63 | + /** | |
| 64 | + * Get the check state | |
| 65 | + * @return the check state | |
| 66 | + */ | |
| 67 | + bool GetCheckState(); | |
| 48 | 68 | |
| 49 | 69 | public: // Properties |
| 50 | 70 | /** |
| ... | ... | @@ -65,81 +85,136 @@ public: // Properties |
| 65 | 85 | |
| 66 | 86 | private: // From Control |
| 67 | 87 | /** |
| 68 | - * @copydoc Toolkit::Control::OnInitialize() | |
| 88 | + * @copydoc Toolkit::Button::OnInitialize() | |
| 69 | 89 | */ |
| 70 | 90 | virtual void OnInitialize(); |
| 71 | 91 | |
| 72 | 92 | /** |
| 73 | - * @copydoc Toolkit::Control::OnStageConnect() | |
| 93 | + * @copydoc Toolkit::Button::OnStageConnect() | |
| 74 | 94 | */ |
| 75 | 95 | virtual void OnStageConnection( int depth ); |
| 76 | 96 | |
| 77 | 97 | /** |
| 78 | - * @copydoc Toolkit::Control::OnStageDisconnection() | |
| 98 | + * @copydoc Toolkit::Button::OnStageDisconnection() | |
| 79 | 99 | */ |
| 80 | 100 | virtual void OnStageDisconnection(); |
| 81 | 101 | |
| 82 | 102 | /** |
| 83 | - * @copydoc Toolkit::Control::OnSizeSet() | |
| 103 | + * @copydoc Toolkit::Button::OnSizeSet() | |
| 84 | 104 | */ |
| 85 | 105 | virtual void OnSizeSet( const Dali::Vector3& targetSize ); |
| 86 | 106 | |
| 87 | 107 | /** |
| 88 | - * @copydoc Toolkit::Control::OnRelayout() | |
| 108 | + * @copydoc Toolkit::Button::OnRelayout() | |
| 89 | 109 | */ |
| 90 | 110 | virtual void OnRelayout( const Dali::Vector2& targetSize, Dali::RelayoutContainer& container ); |
| 91 | 111 | /** |
| 92 | - * @copydoc Toolkit::Control::GetNaturalSize | |
| 112 | + * @copydoc Toolkit::Button::GetNaturalSize | |
| 93 | 113 | */ |
| 94 | 114 | virtual Dali::Vector3 GetNaturalSize(); |
| 95 | 115 | |
| 96 | 116 | /** |
| 97 | - * @copydoc Toolkit::Control::OnStyleChange | |
| 117 | + * @copydoc Toolkit::Button::OnStyleChange | |
| 98 | 118 | */ |
| 99 | 119 | virtual void OnStyleChange( Dali::Toolkit::StyleManager styleManager, Dali::StyleChange::Type change ); |
| 100 | 120 | |
| 101 | 121 | private: |
| 102 | - void OnBounceAnimationFinished( Dali::Animation& handle ); | |
| 103 | - void OnXAnimationFinished( Dali::Animation& src ); | |
| 104 | - void OnYAnimationFinished( Dali::Animation& src ); | |
| 122 | + struct Transition | |
| 123 | + { | |
| 124 | + Dali::Property::Index mTransitionId; | |
| 125 | + Dali::Toolkit::TransitionData mTransitionData; | |
| 126 | + Dali::Animation mAnimation; | |
| 127 | + bool mPlaying; | |
| 128 | + | |
| 129 | + Transition( Dali::Property::Index index, Dali::Toolkit::TransitionData transitionData ) | |
| 130 | + : mTransitionId( index ), | |
| 131 | + mTransitionData( transitionData ), | |
| 132 | + mPlaying(false) | |
| 133 | + { | |
| 134 | + } | |
| 135 | + private: | |
| 136 | + Transition(); | |
| 137 | + }; | |
| 138 | + | |
| 139 | + typedef std::vector<Transition> Transitions; | |
| 140 | + | |
| 141 | + struct Transform | |
| 142 | + { | |
| 143 | + Dali::Property::Index mTransformId; | |
| 144 | + Dali::Property::Map mTransform; | |
| 145 | + | |
| 146 | + Transform( Dali::Property::Index index, Dali::Property::Map& map ) | |
| 147 | + : mTransformId(index), | |
| 148 | + mTransform( map ) | |
| 149 | + { | |
| 150 | + } | |
| 151 | + }; | |
| 152 | + typedef std::vector<Transform> Transforms; | |
| 153 | + | |
| 154 | +private: | |
| 155 | + void StartTransition( Dali::Property::Index transitionId ); | |
| 156 | + | |
| 157 | + void OnTransitionFinished( Dali::Animation& handle ); | |
| 158 | + | |
| 159 | + Transitions::iterator FindTransition( Dali::Property::Index index ); | |
| 160 | + | |
| 161 | + Transforms::iterator FindTransform( Dali::Property::Index index ); | |
| 105 | 162 | |
| 106 | 163 | /** |
| 107 | - * Relayout the visuals as a result of size negotiation | |
| 164 | + * Relayout the visuals as a result of size negotiation using | |
| 165 | + * the transforms provided in the stylesheet | |
| 108 | 166 | */ |
| 109 | 167 | void RelayoutVisuals( const Dali::Vector2& targetSize ); |
| 110 | 168 | |
| 169 | + /** | |
| 170 | + * Relayout the visuals as a result of size negotiation using | |
| 171 | + * programmatically generated transforms | |
| 172 | + */ | |
| 173 | + void RelayoutVisualsManually( const Dali::Vector2& targetSize ); | |
| 174 | + | |
| 175 | + void ResetVisual( Dali::Property::Index index, | |
| 176 | + Dali::Toolkit::Visual::Base& visual, | |
| 177 | + const Dali::Property::Value& value ); | |
| 178 | + | |
| 179 | + void ResetTransition( Dali::Property::Index index, | |
| 180 | + const Dali::Property::Value& value ); | |
| 181 | + | |
| 182 | + void StoreTargetLayouts( Dali::Toolkit::TransitionData transitionData ); | |
| 183 | + | |
| 111 | 184 | private: |
| 112 | - //undefined | |
| 113 | - BeatControl( const BeatControl& ); | |
| 114 | - BeatControl& operator=( const BeatControl& ); | |
| 185 | + // undefined | |
| 186 | + ShadowButton( const ShadowButton& ); | |
| 187 | + ShadowButton& operator=( const ShadowButton& ); | |
| 115 | 188 | |
| 116 | 189 | private: |
| 117 | - // Implementation details | |
| 118 | - Dali::Toolkit::Visual::Base mVisual; | |
| 119 | - Dali::Toolkit::TransitionData mBounceTransition; | |
| 120 | - Dali::Toolkit::TransitionData mLeftTransition; | |
| 121 | - Dali::Toolkit::TransitionData mUpTransition; | |
| 122 | - Dali::Animation mAnimation; | |
| 123 | - Dali::Animation mXAnimation; | |
| 124 | - Dali::Animation mYAnimation; | |
| 190 | + // Data | |
| 191 | + Dali::Toolkit::Visual::Base mBackgroundVisual; | |
| 192 | + Dali::Toolkit::Visual::Base mCheckboxBgVisual; | |
| 193 | + Dali::Toolkit::Visual::Base mCheckboxFgVisual; | |
| 194 | + Dali::Toolkit::Visual::Base mLabelVisual; | |
| 195 | + | |
| 196 | + Transitions mTransitions; | |
| 197 | + Transforms mTransforms; | |
| 198 | + bool mCheckState; | |
| 199 | + bool mActiveState; | |
| 125 | 200 | }; |
| 126 | 201 | |
| 127 | 202 | } // Internal |
| 128 | 203 | |
| 129 | -inline Internal::BeatControl& GetImpl( Demo::BeatControl& handle ) | |
| 204 | +inline Internal::ShadowButton& GetImpl( Demo::ShadowButton& handle ) | |
| 130 | 205 | { |
| 131 | 206 | DALI_ASSERT_ALWAYS( handle ); |
| 132 | 207 | Dali::RefObject& object = handle.GetImplementation(); |
| 133 | - return static_cast<Internal::BeatControl&>(object); | |
| 208 | + return static_cast<Internal::ShadowButton&>(object); | |
| 134 | 209 | } |
| 135 | 210 | |
| 136 | -inline const Internal::BeatControl& GetImpl( const Demo::BeatControl& handle ) | |
| 211 | +inline const Internal::ShadowButton& GetImpl( const Demo::ShadowButton& handle ) | |
| 137 | 212 | { |
| 138 | 213 | DALI_ASSERT_ALWAYS( handle ); |
| 139 | 214 | const Dali::RefObject& object = handle.GetImplementation(); |
| 140 | - return static_cast<const Internal::BeatControl&>(object); | |
| 215 | + return static_cast<const Internal::ShadowButton&>(object); | |
| 141 | 216 | } |
| 142 | 217 | |
| 143 | 218 | } // Demo |
| 144 | 219 | |
| 145 | -#endif // DALI_DEMO_BEAT_CONTROL_IMPL_H | |
| 220 | +#endif // DALI_DEMO_SHADOW_BUTTON_IMPL_H | ... | ... |
examples/transitions/beat-control.cpp renamed to examples/transitions/shadow-button.cpp
| 1 | 1 | /* |
| 2 | - * Copyright (c) 2016 Samsung Electronics Co., Ltd. | |
| 2 | + * Copyright (c) 2017 Samsung Electronics Co., Ltd. | |
| 3 | 3 | * |
| 4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | 5 | * you may not use this file except in compliance with the License. |
| ... | ... | @@ -14,22 +14,22 @@ |
| 14 | 14 | * limitations under the License. |
| 15 | 15 | */ |
| 16 | 16 | |
| 17 | -#include "beat-control.h" | |
| 18 | -#include "beat-control-impl.h" | |
| 17 | +#include "shadow-button.h" | |
| 18 | +#include "shadow-button-impl.h" | |
| 19 | 19 | |
| 20 | 20 | namespace Demo |
| 21 | 21 | { |
| 22 | 22 | |
| 23 | -BeatControl::BeatControl() | |
| 23 | +ShadowButton::ShadowButton() | |
| 24 | 24 | { |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | -BeatControl::BeatControl( const BeatControl& beatControl ) | |
| 28 | -: Control( beatControl ) | |
| 27 | +ShadowButton::ShadowButton( const ShadowButton& control ) | |
| 28 | +: Control( control ) | |
| 29 | 29 | { |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | -BeatControl& BeatControl::operator= ( const BeatControl& rhs ) | |
| 32 | +ShadowButton& ShadowButton::operator= ( const ShadowButton& rhs ) | |
| 33 | 33 | { |
| 34 | 34 | if( &rhs != this ) |
| 35 | 35 | { |
| ... | ... | @@ -38,51 +38,56 @@ BeatControl& BeatControl::operator= ( const BeatControl& rhs ) |
| 38 | 38 | return *this; |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | -BeatControl::~BeatControl() | |
| 41 | +ShadowButton::~ShadowButton() | |
| 42 | 42 | { |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | -BeatControl BeatControl::New() | |
| 45 | +ShadowButton ShadowButton::New() | |
| 46 | 46 | { |
| 47 | - BeatControl beatControl = Internal::BeatControl::New(); | |
| 48 | - return beatControl; | |
| 47 | + ShadowButton control = Internal::ShadowButton::New(); | |
| 48 | + return control; | |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | -BeatControl BeatControl::New( const std::string& url ) | |
| 51 | +ShadowButton ShadowButton::New( const std::string& url ) | |
| 52 | 52 | { |
| 53 | - BeatControl beatControl = Internal::BeatControl::New(); | |
| 54 | - return beatControl; | |
| 53 | + ShadowButton control = Internal::ShadowButton::New(); | |
| 54 | + return control; | |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | -BeatControl BeatControl::DownCast( BaseHandle handle ) | |
| 57 | +ShadowButton ShadowButton::DownCast( BaseHandle handle ) | |
| 58 | 58 | { |
| 59 | - return Control::DownCast< BeatControl, Internal::BeatControl > ( handle ); | |
| 59 | + return Control::DownCast< ShadowButton, Internal::ShadowButton > ( handle ); | |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | -void BeatControl::StartBounceAnimation() | |
| 62 | +void ShadowButton::SetActiveState( bool active ) | |
| 63 | 63 | { |
| 64 | - GetImpl(*this).StartBounceAnimation(); | |
| 64 | + GetImpl(*this).SetActiveState( active ); | |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | -void BeatControl::StartXAnimation() | |
| 67 | +bool ShadowButton::GetActiveState() | |
| 68 | 68 | { |
| 69 | - GetImpl(*this).StartXAnimation(); | |
| 69 | + return GetImpl(*this).GetActiveState(); | |
| 70 | 70 | } |
| 71 | -void BeatControl::StartYAnimation() | |
| 71 | + | |
| 72 | +void ShadowButton::SetCheckState( bool checkState ) | |
| 72 | 73 | { |
| 73 | - GetImpl(*this).StartYAnimation(); | |
| 74 | + GetImpl(*this).SetCheckState( checkState ); | |
| 74 | 75 | } |
| 75 | 76 | |
| 77 | +bool ShadowButton::GetCheckState() | |
| 78 | +{ | |
| 79 | + return GetImpl(*this).GetCheckState(); | |
| 80 | +} | |
| 76 | 81 | |
| 77 | -BeatControl::BeatControl( Internal::BeatControl& implementation ) | |
| 82 | +ShadowButton::ShadowButton( Internal::ShadowButton& implementation ) | |
| 78 | 83 | : Control( implementation ) |
| 79 | 84 | { |
| 80 | 85 | } |
| 81 | 86 | |
| 82 | -BeatControl::BeatControl( Dali::Internal::CustomActor* internal ) | |
| 87 | +ShadowButton::ShadowButton( Dali::Internal::CustomActor* internal ) | |
| 83 | 88 | : Control( internal ) |
| 84 | 89 | { |
| 85 | - VerifyCustomActorPointer< Internal::BeatControl >( internal ) ; | |
| 90 | + VerifyCustomActorPointer< Internal::ShadowButton >( internal ) ; | |
| 86 | 91 | } |
| 87 | 92 | |
| 88 | 93 | ... | ... |
examples/transitions/beat-control.h renamed to examples/transitions/shadow-button.h
| 1 | -#ifndef DALI_DEMO_BEAT_CONTROL_H | |
| 2 | -#define DALI_DEMO_BEAT_CONTROL_H | |
| 1 | +#ifndef DALI_DEMO_SHADOW_BUTTON_H | |
| 2 | +#define DALI_DEMO_SHADOW_BUTTON_H | |
| 3 | 3 | |
| 4 | 4 | /* |
| 5 | - * Copyright (c) 2016 Samsung Electronics Co., Ltd. | |
| 5 | + * Copyright (c) 2017 Samsung Electronics Co., Ltd. | |
| 6 | 6 | * |
| 7 | 7 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 8 | 8 | * you may not use this file except in compliance with the License. |
| ... | ... | @@ -23,20 +23,21 @@ |
| 23 | 23 | namespace Demo |
| 24 | 24 | { |
| 25 | 25 | |
| 26 | +// All type registered controls need to have the same name for the body | |
| 27 | +// and the handle | |
| 26 | 28 | namespace Internal |
| 27 | 29 | { |
| 28 | -// All type registered types need to have the same name for the body and the handle | |
| 29 | -class BeatControl; | |
| 30 | +class ShadowButton; | |
| 30 | 31 | } |
| 31 | 32 | |
| 32 | 33 | /** |
| 33 | - * Control that allows the RGB channels of an image to be altered. | |
| 34 | + * Button that allows the RGB channels of an image to be altered. | |
| 34 | 35 | */ |
| 35 | -class BeatControl : public Dali::Toolkit::Control | |
| 36 | +class ShadowButton : public Dali::Toolkit::Control | |
| 36 | 37 | { |
| 37 | 38 | public: |
| 38 | 39 | /** |
| 39 | - * The start and end property ranges for this control | |
| 40 | + * The start and end property ranges for this Control | |
| 40 | 41 | */ |
| 41 | 42 | enum PropertyRange |
| 42 | 43 | { |
| ... | ... | @@ -50,10 +51,16 @@ public: |
| 50 | 51 | { |
| 51 | 52 | enum |
| 52 | 53 | { |
| 53 | - BOUNCE_TRANSITION = PROPERTY_START_INDEX, | |
| 54 | - LEFT_TRANSITION, | |
| 55 | - UP_TRANSITION, | |
| 56 | - BEAT_VISUAL | |
| 54 | + ACTIVE_TRANSITION = PROPERTY_START_INDEX, | |
| 55 | + INACTIVE_TRANSITION, | |
| 56 | + CHECK_TRANSITION, | |
| 57 | + UNCHECK_TRANSITION, | |
| 58 | + BACKGROUND_VISUAL, | |
| 59 | + CHECKBOX_BG_VISUAL, | |
| 60 | + CHECKBOX_FG_VISUAL, | |
| 61 | + LABEL_VISUAL, | |
| 62 | + ACTIVE_STATE, | |
| 63 | + CHECK_STATE, | |
| 57 | 64 | }; |
| 58 | 65 | }; |
| 59 | 66 | |
| ... | ... | @@ -62,60 +69,81 @@ public: // Construction / destruction |
| 62 | 69 | /** |
| 63 | 70 | * Create an uninitialized handle |
| 64 | 71 | */ |
| 65 | - BeatControl(); | |
| 72 | + ShadowButton(); | |
| 66 | 73 | |
| 67 | 74 | /** |
| 68 | - * Create a new image channel control without an image. Use | |
| 69 | - * SetImage to give this control an image | |
| 75 | + * Create a new image channel button without an image. Use | |
| 76 | + * SetImage to give this button an image | |
| 70 | 77 | */ |
| 71 | - static BeatControl New(); | |
| 78 | + static ShadowButton New(); | |
| 72 | 79 | |
| 73 | 80 | /** |
| 74 | - * Create a new image channel control from a given URL | |
| 81 | + * Create a new image channel button from a given URL | |
| 75 | 82 | */ |
| 76 | - static BeatControl New( const std::string& url ); | |
| 83 | + static ShadowButton New( const std::string& url ); | |
| 77 | 84 | |
| 78 | 85 | /** |
| 79 | 86 | * Destructor. This is non-virtual since derived Handle types must not |
| 80 | 87 | * contain data or virtual methods |
| 81 | 88 | */ |
| 82 | - ~BeatControl(); | |
| 89 | + ~ShadowButton(); | |
| 83 | 90 | |
| 84 | 91 | /** |
| 85 | 92 | * Copy Constructor |
| 86 | 93 | */ |
| 87 | - BeatControl( const BeatControl& beatControl ); | |
| 94 | + ShadowButton( const ShadowButton& shadowButton ); | |
| 88 | 95 | |
| 89 | 96 | /** |
| 90 | 97 | * Assignment Operator |
| 91 | 98 | */ |
| 92 | - BeatControl& operator=( const BeatControl& beatControl ); | |
| 99 | + ShadowButton& operator=( const ShadowButton& shadowButton ); | |
| 93 | 100 | |
| 94 | 101 | /** |
| 95 | 102 | * Downcast |
| 96 | 103 | */ |
| 97 | - static BeatControl DownCast( BaseHandle handle ); | |
| 104 | + static ShadowButton DownCast( BaseHandle handle ); | |
| 98 | 105 | |
| 99 | 106 | public: // API |
| 100 | 107 | |
| 101 | - void StartBounceAnimation(); | |
| 108 | + /** | |
| 109 | + * @brief Set the button to be active or inactive. | |
| 110 | + * | |
| 111 | + * The button will perform a transition if there is a state change. | |
| 112 | + * @param[in] active The active state | |
| 113 | + */ | |
| 114 | + void SetActiveState( bool active ); | |
| 102 | 115 | |
| 103 | - void StartXAnimation(); | |
| 116 | + /** | |
| 117 | + * @brief Get the button's active state | |
| 118 | + * | |
| 119 | + * @return The active state | |
| 120 | + */ | |
| 121 | + bool GetActiveState(); | |
| 104 | 122 | |
| 105 | - void StartYAnimation(); | |
| 123 | + /** | |
| 124 | + * Set the check state | |
| 125 | + * @param[in] checkState The state of the checkbox | |
| 126 | + */ | |
| 127 | + void SetCheckState( bool checkState ); | |
| 128 | + | |
| 129 | + /** | |
| 130 | + * Get the check state | |
| 131 | + * @return the check state | |
| 132 | + */ | |
| 133 | + bool GetCheckState(); | |
| 106 | 134 | |
| 107 | 135 | public: // Not for public use |
| 108 | 136 | /** |
| 109 | 137 | * Create a handle from an implementation |
| 110 | 138 | */ |
| 111 | - BeatControl( Internal::BeatControl& implementation ); | |
| 139 | + ShadowButton( Internal::ShadowButton& implementation ); | |
| 112 | 140 | |
| 113 | 141 | /** |
| 114 | - * Allow the creation of an BeatControl handle from an internal CustomActor pointer | |
| 142 | + * Allow the creation of an ShadowButton handle from an internal CustomActor pointer | |
| 115 | 143 | */ |
| 116 | - BeatControl( Dali::Internal::CustomActor* internal ); | |
| 144 | + ShadowButton( Dali::Internal::CustomActor* internal ); | |
| 117 | 145 | }; |
| 118 | 146 | |
| 119 | 147 | } // namespace Demo |
| 120 | 148 | |
| 121 | -#endif // DALI_DEMO_BEAT_CONTROL_H | |
| 149 | +#endif // DALI_DEMO_SHADOW_BUTTON_H | ... | ... |
examples/transitions/transition-application.cpp
| 1 | 1 | /* |
| 2 | - * Copyright (c) 2016 Samsung Electronics Co., Ltd. | |
| 2 | + * Copyright (c) 2017 Samsung Electronics Co., Ltd. | |
| 3 | 3 | * |
| 4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | 5 | * you may not use this file except in compliance with the License. |
| ... | ... | @@ -24,7 +24,9 @@ |
| 24 | 24 | |
| 25 | 25 | // External includes |
| 26 | 26 | #include <dali-toolkit/dali-toolkit.h> |
| 27 | -#include "beat-control.h" | |
| 27 | +#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h> | |
| 28 | +#include <dali-toolkit/devel-api/visuals/text-visual-properties.h> | |
| 29 | +#include "shadow-button.h" | |
| 28 | 30 | #include <cstdio> |
| 29 | 31 | #include <sstream> |
| 30 | 32 | |
| ... | ... | @@ -33,16 +35,27 @@ |
| 33 | 35 | using namespace Dali; |
| 34 | 36 | using namespace Dali::Toolkit; |
| 35 | 37 | |
| 38 | +namespace | |
| 39 | +{ | |
| 40 | + | |
| 41 | +void SetLabelText( Button button, const char* label ) | |
| 42 | +{ | |
| 43 | + button.SetProperty( Toolkit::Button::Property::LABEL, label ); | |
| 44 | +} | |
| 45 | + | |
| 46 | +} | |
| 47 | + | |
| 36 | 48 | namespace Demo |
| 37 | 49 | { |
| 38 | 50 | |
| 39 | 51 | const char* TransitionApplication::DEMO_THEME_ONE_PATH( DEMO_STYLE_DIR "style-example-theme-one.json" ); |
| 52 | +const char* TransitionApplication::DEMO_THEME_TWO_PATH( DEMO_STYLE_DIR "style-example-theme-two.json" ); | |
| 40 | 53 | |
| 41 | 54 | |
| 42 | 55 | TransitionApplication::TransitionApplication( Application& application ) |
| 43 | 56 | : mApplication( application ), |
| 44 | 57 | mTitle(), |
| 45 | - mBeatControl(), | |
| 58 | + mShadowButton(), | |
| 46 | 59 | mActionButtons(), |
| 47 | 60 | mActionIndex( Property::INVALID_INDEX ) |
| 48 | 61 | { |
| ... | ... | @@ -68,8 +81,8 @@ void TransitionApplication::Create( Application& application ) |
| 68 | 81 | contentLayout.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); |
| 69 | 82 | contentLayout.SetAnchorPoint( AnchorPoint::TOP_LEFT ); |
| 70 | 83 | contentLayout.SetParentOrigin( ParentOrigin::TOP_LEFT ); |
| 71 | - contentLayout.SetCellPadding( Size( 10, 10 ) ); | |
| 72 | - | |
| 84 | + contentLayout.SetCellPadding( Vector2( 0.0f, 5.0f ) ); | |
| 85 | + contentLayout.SetBackgroundColor( Vector4(0.949, 0.949, 0.949, 1.0) ); | |
| 73 | 86 | // Assign all rows the size negotiation property of fitting to children |
| 74 | 87 | |
| 75 | 88 | stage.Add( contentLayout ); |
| ... | ... | @@ -77,63 +90,58 @@ void TransitionApplication::Create( Application& application ) |
| 77 | 90 | mTitle = TextLabel::New( "Custom Control Transition Example" ); |
| 78 | 91 | mTitle.SetName( "Title" ); |
| 79 | 92 | mTitle.SetStyleName("Title"); |
| 80 | - mTitle.SetAnchorPoint( AnchorPoint::TOP_CENTER ); | |
| 81 | - mTitle.SetParentOrigin( ParentOrigin::TOP_CENTER ); | |
| 82 | 93 | mTitle.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); |
| 83 | 94 | mTitle.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); |
| 84 | 95 | mTitle.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); |
| 85 | 96 | contentLayout.Add( mTitle ); |
| 86 | - contentLayout.SetFitHeight(0); | |
| 87 | - | |
| 88 | - mBeatControl = BeatControl::New(); | |
| 89 | - mBeatControl.SetName("BeatControl"); | |
| 90 | - mBeatControl.SetAnchorPoint( AnchorPoint::CENTER ); | |
| 91 | - mBeatControl.SetParentOrigin( ParentOrigin::CENTER ); | |
| 92 | - mBeatControl.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); | |
| 93 | - contentLayout.Add( mBeatControl ); | |
| 94 | - // beat control should fill the tableview cell, so no change to default parameters | |
| 95 | - | |
| 96 | - TableView actionButtonLayout = TableView::New( 1, 4 ); | |
| 97 | + contentLayout.SetFitHeight(0); // Fill width | |
| 98 | + | |
| 99 | + // Provide some padding around the center cell | |
| 100 | + TableView buttonLayout = TableView::New( 3, 3 ); | |
| 101 | + buttonLayout.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); | |
| 102 | + buttonLayout.SetFixedHeight(1, 100 ); | |
| 103 | + buttonLayout.SetFixedWidth(1, 350 ); | |
| 104 | + contentLayout.Add( buttonLayout ); | |
| 105 | + | |
| 106 | + mShadowButton = ShadowButton::New(); | |
| 107 | + mShadowButton.SetName("ShadowButton"); | |
| 108 | + mShadowButton.SetActiveState( false ); | |
| 109 | + mShadowButton.SetAnchorPoint( AnchorPoint::CENTER ); | |
| 110 | + mShadowButton.SetParentOrigin( ParentOrigin::CENTER ); | |
| 111 | + mShadowButton.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); | |
| 112 | + buttonLayout.AddChild( mShadowButton, TableView::CellPosition(1, 1) ); | |
| 113 | + | |
| 114 | + TableView actionButtonLayout = TableView::New( 1, NUMBER_OF_ACTION_BUTTONS+1 ); | |
| 97 | 115 | actionButtonLayout.SetName("ThemeButtonsLayout"); |
| 98 | - actionButtonLayout.SetCellPadding( Vector2( 6.0f, 0.0f ) ); | |
| 99 | - | |
| 100 | - actionButtonLayout.SetAnchorPoint( AnchorPoint::CENTER ); | |
| 101 | - actionButtonLayout.SetParentOrigin( ParentOrigin::CENTER ); | |
| 102 | 116 | actionButtonLayout.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); |
| 103 | 117 | actionButtonLayout.SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::HEIGHT ); |
| 104 | - actionButtonLayout.SetCellPadding( Size( 10, 10 ) ); | |
| 105 | 118 | actionButtonLayout.SetFitHeight( 0 ); |
| 106 | 119 | |
| 107 | 120 | TextLabel label = TextLabel::New( "Action: "); |
| 108 | 121 | label.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); |
| 109 | 122 | label.SetStyleName("ActionLabel"); |
| 110 | - label.SetAnchorPoint( AnchorPoint::TOP_CENTER ); | |
| 111 | - label.SetParentOrigin( ParentOrigin::TOP_CENTER ); | |
| 112 | 123 | actionButtonLayout.AddChild( label, TableView::CellPosition( 0, 0 ) ); |
| 113 | 124 | actionButtonLayout.SetCellAlignment( TableView::CellPosition( 0, 0 ), HorizontalAlignment::LEFT, VerticalAlignment::CENTER ); |
| 114 | 125 | |
| 115 | - for( int i=0; i<3; ++i ) | |
| 126 | + for( int i=0; i<NUMBER_OF_ACTION_BUTTONS; ++i ) | |
| 116 | 127 | { |
| 117 | 128 | mActionButtons[i] = PushButton::New(); |
| 118 | 129 | mActionButtons[i].SetName("ActionButton"); |
| 119 | 130 | mActionButtons[i].SetStyleName("ActionButton"); |
| 120 | - mActionButtons[i].SetParentOrigin( ParentOrigin::CENTER ); | |
| 121 | - mActionButtons[i].SetAnchorPoint( ParentOrigin::CENTER ); | |
| 122 | 131 | mActionButtons[i].SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); |
| 123 | 132 | mActionButtons[i].SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); |
| 124 | 133 | mActionIndex = mActionButtons[i].RegisterProperty( "actionId", i, Property::READ_WRITE ); |
| 125 | 134 | mActionButtons[i].ClickedSignal().Connect( this, &TransitionApplication::OnActionButtonClicked ); |
| 126 | 135 | actionButtonLayout.AddChild( mActionButtons[i], TableView::CellPosition( 0, 1+i ) ); |
| 127 | 136 | } |
| 128 | - mActionButtons[0].SetProperty( Toolkit::Button::Property::LABEL, "Bounce" ); | |
| 129 | - mActionButtons[1].SetProperty( Toolkit::Button::Property::LABEL, "X" ); | |
| 130 | - mActionButtons[2].SetProperty( Toolkit::Button::Property::LABEL, "Y" ); | |
| 137 | + SetLabelText( mActionButtons[0], "Activate" ); | |
| 138 | + SetLabelText( mActionButtons[1], "Check" ); | |
| 139 | + mActionButtons[1].SetProperty( Button::Property::DISABLED, true ); | |
| 131 | 140 | |
| 132 | 141 | contentLayout.Add( actionButtonLayout ); |
| 133 | 142 | contentLayout.SetFitHeight(2); |
| 134 | 143 | } |
| 135 | 144 | |
| 136 | - | |
| 137 | 145 | bool TransitionApplication::OnActionButtonClicked( Button button ) |
| 138 | 146 | { |
| 139 | 147 | int action = button.GetProperty<int>( mActionIndex ); |
| ... | ... | @@ -141,17 +149,39 @@ bool TransitionApplication::OnActionButtonClicked( Button button ) |
| 141 | 149 | { |
| 142 | 150 | case 0: |
| 143 | 151 | { |
| 144 | - mBeatControl.StartBounceAnimation(); | |
| 152 | + bool activeState = mShadowButton.GetActiveState(); | |
| 153 | + mShadowButton.SetActiveState( ! activeState ); | |
| 154 | + if( activeState ) | |
| 155 | + { | |
| 156 | + SetLabelText( button, "Activate" ); | |
| 157 | + } | |
| 158 | + else | |
| 159 | + { | |
| 160 | + SetLabelText( button, "Deactivate" ); | |
| 161 | + } | |
| 162 | + mActionButtons[1].SetProperty( Button::Property::DISABLED, activeState ); | |
| 145 | 163 | break; |
| 146 | 164 | } |
| 147 | 165 | case 1: |
| 148 | 166 | { |
| 149 | - mBeatControl.StartXAnimation(); | |
| 167 | + bool checkState = mShadowButton.GetCheckState(); | |
| 168 | + mShadowButton.SetCheckState( ! checkState ); | |
| 169 | + if( checkState ) | |
| 170 | + { | |
| 171 | + SetLabelText( button, "Check" ); | |
| 172 | + } | |
| 173 | + else | |
| 174 | + { | |
| 175 | + SetLabelText( button, "Uncheck" ); | |
| 176 | + } | |
| 150 | 177 | break; |
| 151 | 178 | } |
| 152 | 179 | case 2: |
| 153 | 180 | { |
| 154 | - mBeatControl.StartYAnimation(); | |
| 181 | + break; | |
| 182 | + } | |
| 183 | + case 3: | |
| 184 | + { | |
| 155 | 185 | break; |
| 156 | 186 | } |
| 157 | 187 | } | ... | ... |
examples/transitions/transition-application.h
| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | #define DALI_DEMO_TRANSITION_APPLICATION_H |
| 3 | 3 | |
| 4 | 4 | /* |
| 5 | - * Copyright (c) 2016 Samsung Electronics Co., Ltd. | |
| 5 | + * Copyright (c) 2017 Samsung Electronics Co., Ltd. | |
| 6 | 6 | * |
| 7 | 7 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 8 | 8 | * you may not use this file except in compliance with the License. |
| ... | ... | @@ -19,9 +19,7 @@ |
| 19 | 19 | |
| 20 | 20 | // External includes |
| 21 | 21 | #include <dali-toolkit/dali-toolkit.h> |
| 22 | -//#include <dali-toolkit/devel-api/controls/slider/slider.h> | |
| 23 | -#include <dali-toolkit/devel-api/controls/popup/popup.h> | |
| 24 | -#include "beat-control.h" | |
| 22 | +#include "shadow-button.h" | |
| 25 | 23 | #include <cstdio> |
| 26 | 24 | #include <sstream> |
| 27 | 25 | |
| ... | ... | @@ -36,6 +34,9 @@ namespace Demo |
| 36 | 34 | class TransitionApplication : public ConnectionTracker |
| 37 | 35 | { |
| 38 | 36 | public: |
| 37 | + static const int NUMBER_OF_ACTION_BUTTONS=2; | |
| 38 | + | |
| 39 | +public: | |
| 39 | 40 | // Constructor |
| 40 | 41 | TransitionApplication( Application& application ); |
| 41 | 42 | |
| ... | ... | @@ -52,15 +53,24 @@ public: |
| 52 | 53 | // Key event handler |
| 53 | 54 | void OnKeyEvent( const KeyEvent& event ); |
| 54 | 55 | |
| 55 | - bool OnActionButtonClicked(Button button); | |
| 56 | + bool OnActionButtonClicked( Button button ); | |
| 56 | 57 | |
| 57 | 58 | static const char* DEMO_THEME_ONE_PATH; |
| 59 | + static const char* DEMO_THEME_TWO_PATH; | |
| 58 | 60 | |
| 59 | 61 | private: |
| 62 | + | |
| 63 | + /** Create a visual map | |
| 64 | + * | |
| 65 | + * @param[in] index The index of the visual to create | |
| 66 | + * @param[out] map The map to generate | |
| 67 | + */ | |
| 68 | + | |
| 60 | 69 | Application& mApplication; |
| 61 | 70 | TextLabel mTitle; |
| 62 | - BeatControl mBeatControl; | |
| 63 | - PushButton mActionButtons[3]; | |
| 71 | + ShadowButton mShadowButton; | |
| 72 | + PushButton mActionButtons[NUMBER_OF_ACTION_BUTTONS]; | |
| 73 | + Property::Index mVisualIndex; | |
| 64 | 74 | Property::Index mActionIndex; |
| 65 | 75 | }; |
| 66 | 76 | ... | ... |
examples/transitions/transition-example.cpp
packaging/com.samsung.dali-demo.spec
resources/images/preMultAlpha.png
0 โ 100644
4.51 KB
resources/style/images/CheckBg.png
0 โ 100644
1.23 KB
resources/style/images/Tick.png
0 โ 100644
1.67 KB
resources/style/images/shadowButtonBg.9.png
0 โ 100644
1.56 KB
resources/style/mobile/images/CheckBg.png
0 โ 100644
1.23 KB
resources/style/mobile/images/Tick.png
0 โ 100644
1.67 KB
resources/style/mobile/images/shadowButtonBg.9.png
0 โ 100644
1.56 KB
resources/style/mobile/style-example-theme-one.json.in
| 1 | 1 | { |
| 2 | + "constants": | |
| 3 | + { | |
| 4 | + "STYLE_DIR":"{APPLICATION_RESOURCE_PATH}/style" | |
| 5 | + }, | |
| 2 | 6 | "styles": |
| 3 | 7 | { |
| 4 | 8 | "Title":{ |
| ... | ... | @@ -69,9 +73,9 @@ |
| 69 | 73 | [ |
| 70 | 74 | { |
| 71 | 75 | "target":"imageVisual", |
| 72 | - "property":"colorAlpha", | |
| 73 | - "initialValue":0, | |
| 74 | - "targetValue":1, | |
| 76 | + "property":"mixColor", | |
| 77 | + "initialValue":[1,1,1,0], | |
| 78 | + "targetValue":[1,1,1,1], | |
| 75 | 79 | "animator": |
| 76 | 80 | { |
| 77 | 81 | "alphaFunction":"EASE_IN_OUT", |
| ... | ... | @@ -84,16 +88,16 @@ |
| 84 | 88 | }, |
| 85 | 89 | { |
| 86 | 90 | "target":"imageVisual", |
| 87 | - "property":"scale", | |
| 88 | - "targetValue":[1,1,1] | |
| 91 | + "property":"size", | |
| 92 | + "targetValue":[1,1] | |
| 89 | 93 | } |
| 90 | 94 | ], |
| 91 | 95 | "disableVisibilityTransition": |
| 92 | 96 | [ |
| 93 | 97 | { |
| 94 | 98 | "target":"imageVisual", |
| 95 | - "property":"colorAlpha", | |
| 96 | - "targetValue":0, | |
| 99 | + "property":"mixColor", | |
| 100 | + "targetValue":[1,1,1,0], | |
| 97 | 101 | "animator": |
| 98 | 102 | { |
| 99 | 103 | "alphaFunction":"EASE_IN_OUT", |
| ... | ... | @@ -106,69 +110,269 @@ |
| 106 | 110 | }, |
| 107 | 111 | { |
| 108 | 112 | "target":"imageVisual", |
| 109 | - "property":"scale", | |
| 113 | + "property":"size", | |
| 110 | 114 | "targetValue":[1,1,1] |
| 111 | 115 | } |
| 112 | 116 | ] |
| 113 | 117 | }, |
| 114 | - "BeatControl": | |
| 118 | + "ShadowButton": | |
| 115 | 119 | { |
| 116 | - "beatVisual":{ | |
| 120 | + "backgroundVisual":{ | |
| 117 | 121 | "visualType":"IMAGE", |
| 118 | - "url":"{APPLICATION_RESOURCE_PATH}/images/Logo-for-demo.png" | |
| 122 | + "url":"{STYLE_DIR}/images/shadowButtonBg.9.png", | |
| 123 | + "mixColor":[1,1,1,0] | |
| 119 | 124 | }, |
| 120 | - | |
| 121 | - "bounceTransition": | |
| 125 | + "checkboxBgVisual":{ | |
| 126 | + "visualType":"IMAGE", | |
| 127 | + "url":"{STYLE_DIR}/images/CheckBg.png", | |
| 128 | + "transform":{ | |
| 129 | + "size":[0.09, 0.28], | |
| 130 | + "offset":[30,0], | |
| 131 | + "offsetSizeMode":[1,1,0,0], | |
| 132 | + "origin":"CENTER_BEGIN", | |
| 133 | + "anchorPoint":"CENTER_BEGIN" | |
| 134 | + } | |
| 135 | + }, | |
| 136 | + "checkboxFgVisual":{ | |
| 137 | + "visualType":"IMAGE", | |
| 138 | + "url":"{STYLE_DIR}/images/Tick.png", | |
| 139 | + "transform":{ | |
| 140 | + "size":[0.09, 0.28], | |
| 141 | + "offset":[30,0], | |
| 142 | + "offsetSizeMode":[1,1,0,0], | |
| 143 | + "origin":"CENTER_BEGIN", | |
| 144 | + "anchorPoint":"CENTER_BEGIN" | |
| 145 | + } | |
| 146 | + }, | |
| 147 | + "labelVisual":{ | |
| 148 | + "visualType":"TEXT", | |
| 149 | + "text":"Don't show again", | |
| 150 | + "pointSize":8, | |
| 151 | + "horizontalAlignment":"END", | |
| 152 | + "verticalAlignment":"CENTER", | |
| 153 | + "textColor":[1,1,1,1], | |
| 154 | + "mixColor":[0.3, 0.3, 0.3, 1], | |
| 155 | + "transform":{ | |
| 156 | + "size":[0.9, 0.9], | |
| 157 | + "offset":[-30,0], | |
| 158 | + "offsetSizeMode":[1,1,0,0], | |
| 159 | + "origin":"CENTER_END", | |
| 160 | + "anchorPoint":"CENTER_END" | |
| 161 | + } | |
| 162 | + }, | |
| 163 | + "activeTransition": | |
| 164 | + [ | |
| 165 | + { | |
| 166 | + "target":"checkboxBgVisual", | |
| 167 | + "property":"size", | |
| 168 | + "initialValue":[0.09, 0.28], | |
| 169 | + "targetValue":[0.12, 0.37], | |
| 170 | + "animator": | |
| 171 | + { | |
| 172 | + "alphaFunction":"EASE_OUT_BACK", | |
| 173 | + "timePeriod": | |
| 174 | + { | |
| 175 | + "duration":0.8, | |
| 176 | + "delay":0 | |
| 177 | + } | |
| 178 | + } | |
| 179 | + }, | |
| 180 | + { | |
| 181 | + "target":"backgroundVisual", | |
| 182 | + "property":"mixColor", | |
| 183 | + "initialValue":[1,1,1,0], | |
| 184 | + "targetValue":[1,1,1,1], | |
| 185 | + "animator": | |
| 186 | + { | |
| 187 | + "alphaFunction":"EASE_OUT_BACK", | |
| 188 | + "timePeriod": | |
| 189 | + { | |
| 190 | + "duration":0.8, | |
| 191 | + "delay":0 | |
| 192 | + } | |
| 193 | + } | |
| 194 | + }, | |
| 195 | + { | |
| 196 | + "target":"backgroundVisual", | |
| 197 | + "property":"size", | |
| 198 | + "initialValue":[0.9, 0.9], | |
| 199 | + "targetValue":[1, 1], | |
| 200 | + "animator": | |
| 201 | + { | |
| 202 | + "alphaFunction":"EASE_OUT_BACK", | |
| 203 | + "timePeriod": | |
| 204 | + { | |
| 205 | + "duration":0.8, | |
| 206 | + "delay":0 | |
| 207 | + } | |
| 208 | + } | |
| 209 | + }, | |
| 210 | + { | |
| 211 | + "target":"checkboxFgVisual", | |
| 212 | + "property":"size", | |
| 213 | + "initialValue":[0.09, 0.28], | |
| 214 | + "targetValue":[0.12, 0.37], | |
| 215 | + "animator": | |
| 216 | + { | |
| 217 | + "alphaFunction":"EASE_OUT_BACK", | |
| 218 | + "timePeriod": | |
| 219 | + { | |
| 220 | + "duration":0.8, | |
| 221 | + "delay":0 | |
| 222 | + } | |
| 223 | + } | |
| 224 | + }, | |
| 225 | + { | |
| 226 | + "target":"labelVisual", | |
| 227 | + "property":"mixColor", | |
| 228 | + "initialValue":[0.2, 0.2, 0.2, 1.0], | |
| 229 | + "targetValue":[0, 0, 0, 1], | |
| 230 | + "animator": | |
| 231 | + { | |
| 232 | + "alphaFunction":"EASE_OUT_BACK", | |
| 233 | + "timePeriod": | |
| 234 | + { | |
| 235 | + "duration":0.8, | |
| 236 | + "delay":0 | |
| 237 | + } | |
| 238 | + } | |
| 239 | + } | |
| 240 | + ], | |
| 241 | + "inactiveTransition": | |
| 122 | 242 | [ |
| 123 | 243 | { |
| 124 | - "target":"beatVisual", | |
| 244 | + "target":"checkboxBgVisual", | |
| 245 | + "property":"size", | |
| 246 | + "initialValue":[0.12, 0.37], | |
| 247 | + "targetValue":[0.09, 0.28], | |
| 248 | + "animator": | |
| 249 | + { | |
| 250 | + "alphaFunction":"EASE_OUT_BACK", | |
| 251 | + "timePeriod": | |
| 252 | + { | |
| 253 | + "duration":0.8, | |
| 254 | + "delay":0 | |
| 255 | + } | |
| 256 | + } | |
| 257 | + }, | |
| 258 | + { | |
| 259 | + "target":"backgroundVisual", | |
| 260 | + "property":"mixColor", | |
| 261 | + "targetValue":[1,1,1,0], | |
| 262 | + "animator": | |
| 263 | + { | |
| 264 | + "alphaFunction":"EASE_OUT_BACK", | |
| 265 | + "timePeriod": | |
| 266 | + { | |
| 267 | + "duration":0.8, | |
| 268 | + "delay":0 | |
| 269 | + } | |
| 270 | + } | |
| 271 | + }, | |
| 272 | + { | |
| 273 | + "target":"checkboxFgVisual", | |
| 274 | + "property":"size", | |
| 275 | + "initialValue":[0.12, 0.37], | |
| 276 | + "targetValue":[0.09, 0.28], | |
| 277 | + "animator": | |
| 278 | + { | |
| 279 | + "alphaFunction":"EASE_OUT_BACK", | |
| 280 | + "timePeriod": | |
| 281 | + { | |
| 282 | + "duration":0.8, | |
| 283 | + "delay":0 | |
| 284 | + } | |
| 285 | + } | |
| 286 | + }, | |
| 287 | + { | |
| 288 | + "target":"labelVisual", | |
| 289 | + "property":"mixColor", | |
| 290 | + "targetValue":[0.4, 0.4, 0.4, 1.0], | |
| 291 | + "animator": | |
| 292 | + { | |
| 293 | + "alphaFunction":"EASE_OUT_BACK", | |
| 294 | + "timePeriod": | |
| 295 | + { | |
| 296 | + "duration":0.8, | |
| 297 | + "delay":0 | |
| 298 | + } | |
| 299 | + } | |
| 300 | + }, | |
| 301 | + { | |
| 302 | + "target":"backgroundVisual", | |
| 125 | 303 | "property":"size", |
| 126 | - "initialValue":[0.5, 0.5], | |
| 127 | - "targetValue":[0.75, 0.75], | |
| 304 | + "targetValue":[0.9, 0.9], | |
| 128 | 305 | "animator": |
| 129 | 306 | { |
| 130 | - "alphaFunction":"BOUNCE", | |
| 307 | + "alphaFunction":"EASE_OUT_BACK", | |
| 131 | 308 | "timePeriod": |
| 132 | 309 | { |
| 133 | - "duration":0.5, | |
| 310 | + "duration":0.8, | |
| 134 | 311 | "delay":0 |
| 135 | 312 | } |
| 136 | 313 | } |
| 137 | 314 | } |
| 138 | 315 | ], |
| 139 | - | |
| 140 | - "leftTransition": | |
| 316 | + "checkTransition": | |
| 141 | 317 | [ |
| 142 | 318 | { |
| 143 | - "target":"beatVisual", | |
| 144 | - "property":"offset", | |
| 145 | - "initialValue":[0, 0], | |
| 146 | - "targetValue":[0.25, 0], | |
| 319 | + "target":"checkboxFgVisual", | |
| 320 | + "property":"pixelArea", | |
| 321 | + "initialValue":[0.0, 0.0, 0.0, 1.0], | |
| 322 | + "targetValue":[0.0, 0.0, 1.0, 1.0], | |
| 323 | + "animator": | |
| 324 | + { | |
| 325 | + "alphaFunction":"EASE_IN", | |
| 326 | + "timePeriod": | |
| 327 | + { | |
| 328 | + "duration":0.4, | |
| 329 | + "delay":0 | |
| 330 | + } | |
| 331 | + } | |
| 332 | + }, | |
| 333 | + { | |
| 334 | + "target":"checkboxFgVisual", | |
| 335 | + "property":"size", | |
| 336 | + "initialValue":[0.0, 0.37], | |
| 337 | + "targetValue":[0.12, 0.37], | |
| 147 | 338 | "animator": |
| 148 | 339 | { |
| 149 | - "alphaFunction":"BOUNCE", | |
| 340 | + "alphaFunction":"EASE_IN", | |
| 150 | 341 | "timePeriod": |
| 151 | 342 | { |
| 152 | - "duration":0.5, | |
| 343 | + "duration":0.4, | |
| 153 | 344 | "delay":0 |
| 154 | 345 | } |
| 155 | 346 | } |
| 156 | 347 | } |
| 157 | 348 | ], |
| 158 | - | |
| 159 | - "upTransition": | |
| 349 | + "uncheckTransition": | |
| 160 | 350 | [ |
| 161 | 351 | { |
| 162 | - "target":"beatVisual", | |
| 163 | - "property":"offset", | |
| 164 | - "initialValue":[0, 0], | |
| 165 | - "targetValue":[0, 0.25], | |
| 352 | + "target":"checkboxFgVisual", | |
| 353 | + "property":"pixelArea", | |
| 354 | + "initialValue":[0.0, 0.0, 1.0, 1.0], | |
| 355 | + "targetValue":[0.0, 0.0, 0.0, 1.0], | |
| 356 | + "animator": | |
| 357 | + { | |
| 358 | + "alphaFunction":"EASE_OUT", | |
| 359 | + "timePeriod": | |
| 360 | + { | |
| 361 | + "duration":0.4, | |
| 362 | + "delay":0 | |
| 363 | + } | |
| 364 | + } | |
| 365 | + }, | |
| 366 | + { | |
| 367 | + "target":"checkboxFgVisual", | |
| 368 | + "property":"size", | |
| 369 | + "targetValue":[0.0, 0.37], | |
| 166 | 370 | "animator": |
| 167 | 371 | { |
| 168 | - "alphaFunction":"BOUNCE", | |
| 372 | + "alphaFunction":"EASE_OUT", | |
| 169 | 373 | "timePeriod": |
| 170 | 374 | { |
| 171 | - "duration":0.5, | |
| 375 | + "duration":0.4, | |
| 172 | 376 | "delay":0 |
| 173 | 377 | } |
| 174 | 378 | } | ... | ... |
resources/style/mobile/style-example-theme-three.json.in
| ... | ... | @@ -53,9 +53,9 @@ |
| 53 | 53 | [ |
| 54 | 54 | { |
| 55 | 55 | "target":"imageVisual", |
| 56 | - "property":"scale", | |
| 57 | - "initialValue":[0.1,0.1,0.1], | |
| 58 | - "targetValue":[1,1,1], | |
| 56 | + "property":"size", | |
| 57 | + "initialValue":[0.1,0.1], | |
| 58 | + "targetValue":[1,1], | |
| 59 | 59 | "animator": |
| 60 | 60 | { |
| 61 | 61 | "alphaFunction":"EASE_IN", |
| ... | ... | @@ -68,17 +68,17 @@ |
| 68 | 68 | }, |
| 69 | 69 | { |
| 70 | 70 | "target":"imageVisual", |
| 71 | - "property":"colorAlpha", | |
| 72 | - "targetValue":1 | |
| 71 | + "property":"mixColor", | |
| 72 | + "targetValue":[1,1,1,1] | |
| 73 | 73 | } |
| 74 | 74 | ], |
| 75 | 75 | "disableVisibilityTransition": |
| 76 | 76 | [ |
| 77 | 77 | { |
| 78 | 78 | "target":"imageVisual", |
| 79 | - "property":"scale", | |
| 80 | - "initialValue":[1,1,1], | |
| 81 | - "targetValue":[0.1,0.1,0.1], | |
| 79 | + "property":"size", | |
| 80 | + "initialValue":[1,1], | |
| 81 | + "targetValue":[0.1,0.1], | |
| 82 | 82 | "animator": |
| 83 | 83 | { |
| 84 | 84 | "alphaFunction":"EASE_OUT", |
| ... | ... | @@ -91,8 +91,8 @@ |
| 91 | 91 | }, |
| 92 | 92 | { |
| 93 | 93 | "target":"imageVisual", |
| 94 | - "property":"colorAlpha", | |
| 95 | - "targetValue":0, | |
| 94 | + "property":"mixColor", | |
| 95 | + "targetValue":[1,1,1,0], | |
| 96 | 96 | "animator": |
| 97 | 97 | { |
| 98 | 98 | "alphaFunction":"EASE_OUT", | ... | ... |
resources/style/mobile/style-example-theme-two.json.in
| ... | ... | @@ -25,10 +25,16 @@ |
| 25 | 25 | |
| 26 | 26 | // Change an icon size, see if it gets properly re-sized |
| 27 | 27 | "RadioButton":{ |
| 28 | - "unselectedStateImage":"{STYLE_DIR}/images/radio-button-unselected.png", | |
| 29 | - "selectedStateImage":"{STYLE_DIR}/images/radio-button-selected.png", | |
| 30 | - "disabledStateImage":"{STYLE_DIR}/images/radio-button-unselected-disabled.png", | |
| 31 | - "imageLabelGap":10, | |
| 28 | + "unselectedVisual": | |
| 29 | + { | |
| 30 | + "visualType": "IMAGE", | |
| 31 | + "url": "{STYLE_DIR}/images/radio-button-unselected.png" | |
| 32 | + }, | |
| 33 | + "selectedVisual": | |
| 34 | + { | |
| 35 | + "visualType": "IMAGE", | |
| 36 | + "url": "{STYLE_DIR}/images/radio-button-selected.png" | |
| 37 | + }, | |
| 32 | 38 | "label":{ |
| 33 | 39 | "textColor": [0.1,1,1,1] |
| 34 | 40 | } |
| ... | ... | @@ -99,9 +105,9 @@ |
| 99 | 105 | [ |
| 100 | 106 | { |
| 101 | 107 | "target":"imageVisual", |
| 102 | - "property":"colorAlpha", | |
| 103 | - "initialValue":0, | |
| 104 | - "targetValue":1, | |
| 108 | + "property":"mixColor", | |
| 109 | + "initialValue":[1,1,1,0], | |
| 110 | + "targetValue":[1,1,1,1], | |
| 105 | 111 | "animator": |
| 106 | 112 | { |
| 107 | 113 | "alphaFunction":"EASE_IN_OUT", |
| ... | ... | @@ -111,14 +117,19 @@ |
| 111 | 117 | "delay":0 |
| 112 | 118 | } |
| 113 | 119 | } |
| 120 | + }, | |
| 121 | + { | |
| 122 | + "target":"imageVisual", | |
| 123 | + "property":"size", | |
| 124 | + "targetValue":[1,1] | |
| 114 | 125 | } |
| 115 | 126 | ], |
| 116 | 127 | "disableVisibilityTransition": |
| 117 | 128 | [ |
| 118 | 129 | { |
| 119 | 130 | "target":"imageVisual", |
| 120 | - "property":"colorAlpha", | |
| 121 | - "targetValue":0, | |
| 131 | + "property":"mixColor", | |
| 132 | + "targetValue":[1,1,1,0], | |
| 122 | 133 | "animator": |
| 123 | 134 | { |
| 124 | 135 | "alphaFunction":"EASE_IN_OUT", |
| ... | ... | @@ -131,8 +142,89 @@ |
| 131 | 142 | }, |
| 132 | 143 | { |
| 133 | 144 | "target":"imageVisual", |
| 134 | - "property":"scale", | |
| 135 | - "targetValue":[1,1,1] | |
| 145 | + "property":"size", | |
| 146 | + "targetValue":[1,1] | |
| 147 | + } | |
| 148 | + ] | |
| 149 | + }, | |
| 150 | + "ShadowButton": | |
| 151 | + { | |
| 152 | + "backgroundVisual":{ | |
| 153 | + "visualType":"IMAGE", | |
| 154 | + "url":"{STYLE_DIR}/images/shadowButtonBg.9.png" | |
| 155 | + }, | |
| 156 | + "checkboxBgVisual":{ | |
| 157 | + "visualType":"IMAGE", | |
| 158 | + "url":"{STYLE_DIR}/images/CheckBg.png", | |
| 159 | + "transform":{ | |
| 160 | + "size":[0.09, 0.28], | |
| 161 | + "offset":[30,0], | |
| 162 | + "offsetSizeMode":[1,1,0,0], | |
| 163 | + "origin":"CENTER_BEGIN", | |
| 164 | + "anchorPoint":"CENTER_BEGIN" | |
| 165 | + } | |
| 166 | + }, | |
| 167 | + "checkboxFgVisual":{ | |
| 168 | + "visualType":"IMAGE", | |
| 169 | + "url":"{STYLE_DIR}/images/Tick.png", | |
| 170 | + "transform":{ | |
| 171 | + "size":[0.09, 0.28], | |
| 172 | + "offset":[30,0], | |
| 173 | + "offsetSizeMode":[1,1,0,0], | |
| 174 | + "origin":"CENTER_BEGIN", | |
| 175 | + "anchorPoint":"CENTER_BEGIN" | |
| 176 | + } | |
| 177 | + }, | |
| 178 | + "labelVisual":{ | |
| 179 | + "visualType":"TEXT", | |
| 180 | + "text":"Don't show again", | |
| 181 | + "pointSize":8, | |
| 182 | + "horizontalAlignment":"END", | |
| 183 | + "verticalAlignment":"CENTER", | |
| 184 | + "textColor":[1,1,1,1], | |
| 185 | + "mixColor":[0.3, 0.3, 0.3, 1], | |
| 186 | + "transform":{ | |
| 187 | + "size":[0.9, 0.9], | |
| 188 | + "offset":[-30,0], | |
| 189 | + "offsetSizeMode":[1,1,0,0], | |
| 190 | + "origin":"CENTER_END", | |
| 191 | + "anchorPoint":"CENTER_END" | |
| 192 | + } | |
| 193 | + }, | |
| 194 | + "activeTransition": | |
| 195 | + [ | |
| 196 | + { | |
| 197 | + "target":"checkboxBgVisual", | |
| 198 | + "property":"size", | |
| 199 | + "initialValue":[0.09, 0.28], | |
| 200 | + "targetValue":[0.12, 0.37], | |
| 201 | + "animator": | |
| 202 | + { | |
| 203 | + "alphaFunction":"EASE_OUT_BACK", | |
| 204 | + "timePeriod": | |
| 205 | + { | |
| 206 | + "duration":0.8, | |
| 207 | + "delay":0 | |
| 208 | + } | |
| 209 | + } | |
| 210 | + } | |
| 211 | + ], | |
| 212 | + "inactiveTransition": | |
| 213 | + [ | |
| 214 | + { | |
| 215 | + "target":"checkboxBgVisual", | |
| 216 | + "property":"size", | |
| 217 | + "initialValue":[0.12, 0.37], | |
| 218 | + "targetValue":[0.09, 0.28], | |
| 219 | + "animator": | |
| 220 | + { | |
| 221 | + "alphaFunction":"EASE_OUT_BACK", | |
| 222 | + "timePeriod": | |
| 223 | + { | |
| 224 | + "duration":0.8, | |
| 225 | + "delay":0 | |
| 226 | + } | |
| 227 | + } | |
| 136 | 228 | } |
| 137 | 229 | ] |
| 138 | 230 | } | ... | ... |
resources/style/style-example-theme-one.json.in
| 1 | 1 | { |
| 2 | + "constants": | |
| 3 | + { | |
| 4 | + "STYLE_DIR":"{APPLICATION_RESOURCE_PATH}/style" | |
| 5 | + }, | |
| 2 | 6 | "styles": |
| 3 | 7 | { |
| 4 | 8 | "Title":{ |
| ... | ... | @@ -69,9 +73,9 @@ |
| 69 | 73 | [ |
| 70 | 74 | { |
| 71 | 75 | "target":"imageVisual", |
| 72 | - "property":"colorAlpha", | |
| 73 | - "initialValue":0, | |
| 74 | - "targetValue":1, | |
| 76 | + "property":"mixColor", | |
| 77 | + "initialValue":[1,1,1,0], | |
| 78 | + "targetValue":[1,1,1,1], | |
| 75 | 79 | "animator": |
| 76 | 80 | { |
| 77 | 81 | "alphaFunction":"EASE_IN_OUT", |
| ... | ... | @@ -84,16 +88,16 @@ |
| 84 | 88 | }, |
| 85 | 89 | { |
| 86 | 90 | "target":"imageVisual", |
| 87 | - "property":"scale", | |
| 88 | - "targetValue":[1,1,1] | |
| 91 | + "property":"size", | |
| 92 | + "targetValue":[1,1] | |
| 89 | 93 | } |
| 90 | 94 | ], |
| 91 | 95 | "disableVisibilityTransition": |
| 92 | 96 | [ |
| 93 | 97 | { |
| 94 | 98 | "target":"imageVisual", |
| 95 | - "property":"colorAlpha", | |
| 96 | - "targetValue":0, | |
| 99 | + "property":"mixColor", | |
| 100 | + "targetValue":[1,1,1,0], | |
| 97 | 101 | "animator": |
| 98 | 102 | { |
| 99 | 103 | "alphaFunction":"EASE_IN_OUT", |
| ... | ... | @@ -106,69 +110,269 @@ |
| 106 | 110 | }, |
| 107 | 111 | { |
| 108 | 112 | "target":"imageVisual", |
| 109 | - "property":"scale", | |
| 113 | + "property":"size", | |
| 110 | 114 | "targetValue":[1,1,1] |
| 111 | 115 | } |
| 112 | 116 | ] |
| 113 | 117 | }, |
| 114 | - "BeatControl": | |
| 118 | + "ShadowButton": | |
| 115 | 119 | { |
| 116 | - "beatVisual":{ | |
| 120 | + "backgroundVisual":{ | |
| 117 | 121 | "visualType":"IMAGE", |
| 118 | - "url":"{APPLICATION_RESOURCE_PATH}/images/Logo-for-demo.png" | |
| 122 | + "url":"{STYLE_DIR}/images/shadowButtonBg.9.png", | |
| 123 | + "mixColor":[1,1,1,0] | |
| 119 | 124 | }, |
| 120 | - | |
| 121 | - "bounceTransition": | |
| 125 | + "checkboxBgVisual":{ | |
| 126 | + "visualType":"IMAGE", | |
| 127 | + "url":"{STYLE_DIR}/images/CheckBg.png", | |
| 128 | + "transform":{ | |
| 129 | + "size":[0.09, 0.28], | |
| 130 | + "offset":[30,0], | |
| 131 | + "offsetSizeMode":[1,1,0,0], | |
| 132 | + "origin":"CENTER_BEGIN", | |
| 133 | + "anchorPoint":"CENTER_BEGIN" | |
| 134 | + } | |
| 135 | + }, | |
| 136 | + "checkboxFgVisual":{ | |
| 137 | + "visualType":"IMAGE", | |
| 138 | + "url":"{STYLE_DIR}/images/Tick.png", | |
| 139 | + "transform":{ | |
| 140 | + "size":[0.09, 0.28], | |
| 141 | + "offset":[30,0], | |
| 142 | + "offsetSizeMode":[1,1,0,0], | |
| 143 | + "origin":"CENTER_BEGIN", | |
| 144 | + "anchorPoint":"CENTER_BEGIN" | |
| 145 | + } | |
| 146 | + }, | |
| 147 | + "labelVisual":{ | |
| 148 | + "visualType":"TEXT", | |
| 149 | + "text":"Don't show again", | |
| 150 | + "pointSize":20, | |
| 151 | + "horizontalAlignment":"END", | |
| 152 | + "verticalAlignment":"CENTER", | |
| 153 | + "textColor":[1,1,1,1], | |
| 154 | + "mixColor":[0.3, 0.3, 0.3, 1], | |
| 155 | + "transform":{ | |
| 156 | + "size":[0.9, 0.9], | |
| 157 | + "offset":[-30,0], | |
| 158 | + "offsetSizeMode":[1,1,0,0], | |
| 159 | + "origin":"CENTER_END", | |
| 160 | + "anchorPoint":"CENTER_END" | |
| 161 | + } | |
| 162 | + }, | |
| 163 | + "activeTransition": | |
| 164 | + [ | |
| 165 | + { | |
| 166 | + "target":"checkboxBgVisual", | |
| 167 | + "property":"size", | |
| 168 | + "initialValue":[0.09, 0.28], | |
| 169 | + "targetValue":[0.12, 0.37], | |
| 170 | + "animator": | |
| 171 | + { | |
| 172 | + "alphaFunction":"EASE_OUT_BACK", | |
| 173 | + "timePeriod": | |
| 174 | + { | |
| 175 | + "duration":0.8, | |
| 176 | + "delay":0 | |
| 177 | + } | |
| 178 | + } | |
| 179 | + }, | |
| 180 | + { | |
| 181 | + "target":"backgroundVisual", | |
| 182 | + "property":"mixColor", | |
| 183 | + "initialValue":[1,1,1,0], | |
| 184 | + "targetValue":[1,1,1,1], | |
| 185 | + "animator": | |
| 186 | + { | |
| 187 | + "alphaFunction":"EASE_OUT_BACK", | |
| 188 | + "timePeriod": | |
| 189 | + { | |
| 190 | + "duration":0.8, | |
| 191 | + "delay":0 | |
| 192 | + } | |
| 193 | + } | |
| 194 | + }, | |
| 195 | + { | |
| 196 | + "target":"backgroundVisual", | |
| 197 | + "property":"size", | |
| 198 | + "initialValue":[0.9, 0.9], | |
| 199 | + "targetValue":[1, 1], | |
| 200 | + "animator": | |
| 201 | + { | |
| 202 | + "alphaFunction":"EASE_OUT_BACK", | |
| 203 | + "timePeriod": | |
| 204 | + { | |
| 205 | + "duration":0.8, | |
| 206 | + "delay":0 | |
| 207 | + } | |
| 208 | + } | |
| 209 | + }, | |
| 210 | + { | |
| 211 | + "target":"checkboxFgVisual", | |
| 212 | + "property":"size", | |
| 213 | + "initialValue":[0.09, 0.28], | |
| 214 | + "targetValue":[0.12, 0.37], | |
| 215 | + "animator": | |
| 216 | + { | |
| 217 | + "alphaFunction":"EASE_OUT_BACK", | |
| 218 | + "timePeriod": | |
| 219 | + { | |
| 220 | + "duration":0.8, | |
| 221 | + "delay":0 | |
| 222 | + } | |
| 223 | + } | |
| 224 | + }, | |
| 225 | + { | |
| 226 | + "target":"labelVisual", | |
| 227 | + "property":"mixColor", | |
| 228 | + "initialValue":[0.2, 0.2, 0.2, 1.0], | |
| 229 | + "targetValue":[0, 0, 0, 1], | |
| 230 | + "animator": | |
| 231 | + { | |
| 232 | + "alphaFunction":"EASE_OUT_BACK", | |
| 233 | + "timePeriod": | |
| 234 | + { | |
| 235 | + "duration":0.8, | |
| 236 | + "delay":0 | |
| 237 | + } | |
| 238 | + } | |
| 239 | + } | |
| 240 | + ], | |
| 241 | + "inactiveTransition": | |
| 122 | 242 | [ |
| 123 | 243 | { |
| 124 | - "target":"beatVisual", | |
| 244 | + "target":"checkboxBgVisual", | |
| 245 | + "property":"size", | |
| 246 | + "initialValue":[0.12, 0.37], | |
| 247 | + "targetValue":[0.09, 0.28], | |
| 248 | + "animator": | |
| 249 | + { | |
| 250 | + "alphaFunction":"EASE_OUT_BACK", | |
| 251 | + "timePeriod": | |
| 252 | + { | |
| 253 | + "duration":0.8, | |
| 254 | + "delay":0 | |
| 255 | + } | |
| 256 | + } | |
| 257 | + }, | |
| 258 | + { | |
| 259 | + "target":"backgroundVisual", | |
| 260 | + "property":"mixColor", | |
| 261 | + "targetValue":[1,1,1,0], | |
| 262 | + "animator": | |
| 263 | + { | |
| 264 | + "alphaFunction":"EASE_OUT_BACK", | |
| 265 | + "timePeriod": | |
| 266 | + { | |
| 267 | + "duration":0.8, | |
| 268 | + "delay":0 | |
| 269 | + } | |
| 270 | + } | |
| 271 | + }, | |
| 272 | + { | |
| 273 | + "target":"checkboxFgVisual", | |
| 274 | + "property":"size", | |
| 275 | + "initialValue":[0.12, 0.37], | |
| 276 | + "targetValue":[0.09, 0.28], | |
| 277 | + "animator": | |
| 278 | + { | |
| 279 | + "alphaFunction":"EASE_OUT_BACK", | |
| 280 | + "timePeriod": | |
| 281 | + { | |
| 282 | + "duration":0.8, | |
| 283 | + "delay":0 | |
| 284 | + } | |
| 285 | + } | |
| 286 | + }, | |
| 287 | + { | |
| 288 | + "target":"labelVisual", | |
| 289 | + "property":"mixColor", | |
| 290 | + "targetValue":[0.4, 0.4, 0.4, 1.0], | |
| 291 | + "animator": | |
| 292 | + { | |
| 293 | + "alphaFunction":"EASE_OUT_BACK", | |
| 294 | + "timePeriod": | |
| 295 | + { | |
| 296 | + "duration":0.8, | |
| 297 | + "delay":0 | |
| 298 | + } | |
| 299 | + } | |
| 300 | + }, | |
| 301 | + { | |
| 302 | + "target":"backgroundVisual", | |
| 125 | 303 | "property":"size", |
| 126 | - "initialValue":[0.5, 0.5], | |
| 127 | - "targetValue":[0.75, 0.75], | |
| 304 | + "targetValue":[0.9, 0.9], | |
| 128 | 305 | "animator": |
| 129 | 306 | { |
| 130 | - "alphaFunction":"BOUNCE", | |
| 307 | + "alphaFunction":"EASE_OUT_BACK", | |
| 131 | 308 | "timePeriod": |
| 132 | 309 | { |
| 133 | - "duration":0.5, | |
| 310 | + "duration":0.8, | |
| 134 | 311 | "delay":0 |
| 135 | 312 | } |
| 136 | 313 | } |
| 137 | 314 | } |
| 138 | 315 | ], |
| 139 | - | |
| 140 | - "leftTransition": | |
| 316 | + "checkTransition": | |
| 141 | 317 | [ |
| 142 | 318 | { |
| 143 | - "target":"beatVisual", | |
| 144 | - "property":"offset", | |
| 145 | - "initialValue":[0, 0], | |
| 146 | - "targetValue":[0.25, 0], | |
| 319 | + "target":"checkboxFgVisual", | |
| 320 | + "property":"pixelArea", | |
| 321 | + "initialValue":[0.0, 0.0, 0.0, 1.0], | |
| 322 | + "targetValue":[0.0, 0.0, 1.0, 1.0], | |
| 323 | + "animator": | |
| 324 | + { | |
| 325 | + "alphaFunction":"EASE_IN", | |
| 326 | + "timePeriod": | |
| 327 | + { | |
| 328 | + "duration":0.4, | |
| 329 | + "delay":0 | |
| 330 | + } | |
| 331 | + } | |
| 332 | + }, | |
| 333 | + { | |
| 334 | + "target":"checkboxFgVisual", | |
| 335 | + "property":"size", | |
| 336 | + "initialValue":[0.0, 0.37], | |
| 337 | + "targetValue":[0.12, 0.37], | |
| 147 | 338 | "animator": |
| 148 | 339 | { |
| 149 | - "alphaFunction":"BOUNCE", | |
| 340 | + "alphaFunction":"EASE_IN", | |
| 150 | 341 | "timePeriod": |
| 151 | 342 | { |
| 152 | - "duration":0.5, | |
| 343 | + "duration":0.4, | |
| 153 | 344 | "delay":0 |
| 154 | 345 | } |
| 155 | 346 | } |
| 156 | 347 | } |
| 157 | 348 | ], |
| 158 | - | |
| 159 | - "upTransition": | |
| 349 | + "uncheckTransition": | |
| 160 | 350 | [ |
| 161 | 351 | { |
| 162 | - "target":"beatVisual", | |
| 163 | - "property":"offset", | |
| 164 | - "initialValue":[0, 0], | |
| 165 | - "targetValue":[0, 0.25], | |
| 352 | + "target":"checkboxFgVisual", | |
| 353 | + "property":"pixelArea", | |
| 354 | + "initialValue":[0.0, 0.0, 1.0, 1.0], | |
| 355 | + "targetValue":[0.0, 0.0, 0.0, 1.0], | |
| 356 | + "animator": | |
| 357 | + { | |
| 358 | + "alphaFunction":"EASE_OUT", | |
| 359 | + "timePeriod": | |
| 360 | + { | |
| 361 | + "duration":0.4, | |
| 362 | + "delay":0 | |
| 363 | + } | |
| 364 | + } | |
| 365 | + }, | |
| 366 | + { | |
| 367 | + "target":"checkboxFgVisual", | |
| 368 | + "property":"size", | |
| 369 | + "targetValue":[0.0, 0.37], | |
| 166 | 370 | "animator": |
| 167 | 371 | { |
| 168 | - "alphaFunction":"BOUNCE", | |
| 372 | + "alphaFunction":"EASE_OUT", | |
| 169 | 373 | "timePeriod": |
| 170 | 374 | { |
| 171 | - "duration":0.5, | |
| 375 | + "duration":0.4, | |
| 172 | 376 | "delay":0 |
| 173 | 377 | } |
| 174 | 378 | } | ... | ... |
resources/style/style-example-theme-three.json.in
| ... | ... | @@ -53,9 +53,9 @@ |
| 53 | 53 | [ |
| 54 | 54 | { |
| 55 | 55 | "target":"imageVisual", |
| 56 | - "property":"scale", | |
| 57 | - "initialValue":[0.1,0.1,0.1], | |
| 58 | - "targetValue":[1,1,1], | |
| 56 | + "property":"size", | |
| 57 | + "initialValue":[0.1,0.1], | |
| 58 | + "targetValue":[1,1], | |
| 59 | 59 | "animator": |
| 60 | 60 | { |
| 61 | 61 | "alphaFunction":"EASE_IN", |
| ... | ... | @@ -68,17 +68,17 @@ |
| 68 | 68 | }, |
| 69 | 69 | { |
| 70 | 70 | "target":"imageVisual", |
| 71 | - "property":"colorAlpha", | |
| 72 | - "targetValue":1 | |
| 71 | + "property":"mixColor", | |
| 72 | + "targetValue":[1,1,1,1] | |
| 73 | 73 | } |
| 74 | 74 | ], |
| 75 | 75 | "disableVisibilityTransition": |
| 76 | 76 | [ |
| 77 | 77 | { |
| 78 | 78 | "target":"imageVisual", |
| 79 | - "property":"scale", | |
| 80 | - "initialValue":[1,1,1], | |
| 81 | - "targetValue":[0.1,0.1,0.1], | |
| 79 | + "property":"size", | |
| 80 | + "initialValue":[1,1], | |
| 81 | + "targetValue":[0.1,0.1], | |
| 82 | 82 | "animator": |
| 83 | 83 | { |
| 84 | 84 | "alphaFunction":"EASE_OUT", |
| ... | ... | @@ -91,8 +91,8 @@ |
| 91 | 91 | }, |
| 92 | 92 | { |
| 93 | 93 | "target":"imageVisual", |
| 94 | - "property":"colorAlpha", | |
| 95 | - "targetValue":0, | |
| 94 | + "property":"mixColor", | |
| 95 | + "targetValue":[1,1,1,0], | |
| 96 | 96 | "animator": |
| 97 | 97 | { |
| 98 | 98 | "alphaFunction":"EASE_OUT", | ... | ... |
resources/style/style-example-theme-two.json.in
| ... | ... | @@ -105,9 +105,9 @@ |
| 105 | 105 | [ |
| 106 | 106 | { |
| 107 | 107 | "target":"imageVisual", |
| 108 | - "property":"colorAlpha", | |
| 109 | - "initialValue":0, | |
| 110 | - "targetValue":1, | |
| 108 | + "property":"mixColor", | |
| 109 | + "initialValue":[1,1,1,0], | |
| 110 | + "targetValue":[1,1,1,1], | |
| 111 | 111 | "animator": |
| 112 | 112 | { |
| 113 | 113 | "alphaFunction":"EASE_IN_OUT", |
| ... | ... | @@ -120,16 +120,16 @@ |
| 120 | 120 | }, |
| 121 | 121 | { |
| 122 | 122 | "target":"imageVisual", |
| 123 | - "property":"scale", | |
| 124 | - "targetValue":[1,1,1] | |
| 123 | + "property":"size", | |
| 124 | + "targetValue":[1,1] | |
| 125 | 125 | } |
| 126 | 126 | ], |
| 127 | 127 | "disableVisibilityTransition": |
| 128 | 128 | [ |
| 129 | 129 | { |
| 130 | 130 | "target":"imageVisual", |
| 131 | - "property":"colorAlpha", | |
| 132 | - "targetValue":0, | |
| 131 | + "property":"mixColor", | |
| 132 | + "targetValue":[1,1,1,0], | |
| 133 | 133 | "animator": |
| 134 | 134 | { |
| 135 | 135 | "alphaFunction":"EASE_IN_OUT", |
| ... | ... | @@ -142,8 +142,89 @@ |
| 142 | 142 | }, |
| 143 | 143 | { |
| 144 | 144 | "target":"imageVisual", |
| 145 | - "property":"scale", | |
| 146 | - "targetValue":[1,1,1] | |
| 145 | + "property":"size", | |
| 146 | + "targetValue":[1,1] | |
| 147 | + } | |
| 148 | + ] | |
| 149 | + }, | |
| 150 | + "ShadowButton": | |
| 151 | + { | |
| 152 | + "backgroundVisual":{ | |
| 153 | + "visualType":"IMAGE", | |
| 154 | + "url":"{STYLE_DIR}/images/shadowButtonBg.9.png" | |
| 155 | + }, | |
| 156 | + "checkboxBgVisual":{ | |
| 157 | + "visualType":"IMAGE", | |
| 158 | + "url":"{STYLE_DIR}/images/CheckBg.png", | |
| 159 | + "transform":{ | |
| 160 | + "size":[0.09, 0.28], | |
| 161 | + "offset":[30,0], | |
| 162 | + "offsetSizeMode":[1,1,0,0], | |
| 163 | + "origin":"CENTER_BEGIN", | |
| 164 | + "anchorPoint":"CENTER_BEGIN" | |
| 165 | + } | |
| 166 | + }, | |
| 167 | + "checkboxFgVisual":{ | |
| 168 | + "visualType":"IMAGE", | |
| 169 | + "url":"{STYLE_DIR}/images/Tick.png", | |
| 170 | + "transform":{ | |
| 171 | + "size":[0.09, 0.28], | |
| 172 | + "offset":[30,0], | |
| 173 | + "offsetSizeMode":[1,1,0,0], | |
| 174 | + "origin":"CENTER_BEGIN", | |
| 175 | + "anchorPoint":"CENTER_BEGIN" | |
| 176 | + } | |
| 177 | + }, | |
| 178 | + "labelVisual":{ | |
| 179 | + "visualType":"TEXT", | |
| 180 | + "text":"Don't show again", | |
| 181 | + "pointSize":20, | |
| 182 | + "horizontalAlignment":"END", | |
| 183 | + "verticalAlignment":"CENTER", | |
| 184 | + "textColor":[1,1,1,1], | |
| 185 | + "mixColor":[0.3, 0.3, 0.3, 1], | |
| 186 | + "transform":{ | |
| 187 | + "size":[0.9, 0.9], | |
| 188 | + "offset":[-30,0], | |
| 189 | + "offsetSizeMode":[1,1,0,0], | |
| 190 | + "origin":"CENTER_END", | |
| 191 | + "anchorPoint":"CENTER_END" | |
| 192 | + } | |
| 193 | + }, | |
| 194 | + "activeTransition": | |
| 195 | + [ | |
| 196 | + { | |
| 197 | + "target":"checkboxBgVisual", | |
| 198 | + "property":"size", | |
| 199 | + "initialValue":[0.09, 0.28], | |
| 200 | + "targetValue":[0.12, 0.37], | |
| 201 | + "animator": | |
| 202 | + { | |
| 203 | + "alphaFunction":"EASE_OUT_BACK", | |
| 204 | + "timePeriod": | |
| 205 | + { | |
| 206 | + "duration":0.8, | |
| 207 | + "delay":0 | |
| 208 | + } | |
| 209 | + } | |
| 210 | + } | |
| 211 | + ], | |
| 212 | + "inactiveTransition": | |
| 213 | + [ | |
| 214 | + { | |
| 215 | + "target":"checkboxBgVisual", | |
| 216 | + "property":"size", | |
| 217 | + "initialValue":[0.12, 0.37], | |
| 218 | + "targetValue":[0.09, 0.28], | |
| 219 | + "animator": | |
| 220 | + { | |
| 221 | + "alphaFunction":"EASE_OUT_BACK", | |
| 222 | + "timePeriod": | |
| 223 | + { | |
| 224 | + "duration":0.8, | |
| 225 | + "delay":0 | |
| 226 | + } | |
| 227 | + } | |
| 147 | 228 | } |
| 148 | 229 | ] |
| 149 | 230 | } | ... | ... |