<label>First Person Camera Game</label>
</ui-application>
<ui-application appid="transitions.example" exec="/usr/apps/com.samsung.dali-demo/bin/transitions.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
+ <label>Shadow button</label>
+ </ui-application>
+ <ui-application appid="visual-transitions.example" exec="/usr/apps/com.samsung.dali-demo/bin/visual-transitions.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
<label>Visual Transitions</label>
</ui-application>
<ui-application appid="animated-images.example" exec="/usr/apps/com.samsung.dali-demo/bin/animated-images.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
#include <dali/dali.h>
#include <dali-toolkit/dali-toolkit.h>
#include <dali-toolkit/devel-api/controls/popup/popup.h>
+#include <dali-toolkit/public-api/visuals/image-visual-properties.h>
#include "shared/view.h"
#include <iostream>
}
}
- void OnImageLoaded( ResourceImage image )
- {
- DALI_ASSERT_DEBUG( image == mNextImage );
- mImageView.SetImage( image );
- mImageView.SetSize( Size( image.GetWidth(), image.GetHeight() ) );
- mImageLoading = false;
-
- // We have finished loading, if a resize had occured during the load, trigger another load now.
- if( mQueuedImageLoad )
- {
- mQueuedImageLoad = false;
- LoadImage();
- }
- }
-
bool OnControlTouched( Actor actor, const TouchData& event )
{
if(event.GetPointCount() > 0)
const char * const path = IMAGE_PATHS[ mCurrentPath ];
Stage stage = Stage::GetCurrent();
Size imageSize = stage.GetSize() * mImageStageScale;
- const ImageDimensions imageSizeInt = ImageDimensions::FromFloatArray( &imageSize.x );
+ mImageView.SetSize( imageSize );
- ResourceImage image = ResourceImage::New( path, imageSizeInt, mFittingMode, mSamplingMode );
+ Property::Map map;
+ map[Toolkit::ImageVisual::Property::URL] = path;
+ map[Toolkit::ImageVisual::Property::DESIRED_WIDTH] = imageSize.x;
+ map[Toolkit::ImageVisual::Property::DESIRED_HEIGHT] = imageSize.y;
+ map[Toolkit::ImageVisual::Property::FITTING_MODE] = mFittingMode;
+ map[Toolkit::ImageVisual::Property::SAMPLING_MODE] = mSamplingMode;
- // If the image was cached, the load has already occured, bypass hooking the signal.
- if( image.GetLoadingState() )
- {
- OnImageLoaded( image );
- }
- else
- {
- image.LoadingFinishedSignal().Connect( this, &ImageScalingAndFilteringController::OnImageLoaded );
- }
+ mImageView.SetProperty( Toolkit::ImageView::Property::IMAGE, map );
- mNextImage = image;
}
void ResizeImage()
Stage stage = Stage::GetCurrent();
Size imageSize = stage.GetSize() * mImageStageScale;
- // If an image is already loading, queue another load when it has finished.
- // This way we get continuous updates instead of constantly re-requesting loads.
- if( mImageLoading )
- {
- mQueuedImageLoad = true;
- }
- else
- {
- LoadImage();
- }
+ LoadImage();
// Border size needs to be modified to take into account the width of the frame.
Vector2 borderScale( ( imageSize + Vector2( BORDER_WIDTH * 2.0f, BORDER_WIDTH * 2.0f ) ) / stage.GetSize() );
Toolkit::ImageView mGrabCorner;
PanGestureDetector mPanGestureDetector;
Toolkit::ImageView mImageView;
- ResourceImage mNextImage; //< Currently-loading image
Vector2 mImageStageScale;
int mCurrentPath;
FittingMode::Type mFittingMode;
const unsigned NUM_IMAGE_PATHS = sizeof(IMAGE_PATHS) / sizeof(IMAGE_PATHS[0]) - 1u;
-/**
- * Creates an Image
- *
- * @param[in] filename The path of the image.
- * @param[in] width The width of the image in pixels.
- * @param[in] height The height of the image in pixels.
- * @param[in] fittingMode The mode to use when scaling the image to fit the desired dimensions.
- */
-Image CreateImage(const std::string& filename, unsigned int width, unsigned int height, Dali::FittingMode::Type fittingMode )
-{
-#ifdef DEBUG_PRINT_DIAGNOSTICS
- fprintf( stderr, "CreateImage(%s, %u, %u, fittingMode=%u)\n", filename.c_str(), width, height, unsigned( fittingMode ) );
-#endif
- Image image = ResourceImage::New( filename, ImageDimensions( width, height ), fittingMode, Dali::SamplingMode::BOX_THEN_LINEAR );
-
- return image;
-}
/**
* Creates an ImageView
* @param[in] height The height of the image in pixels.
* @param[in] fittingMode The mode to use when scaling the image to fit the desired dimensions.
*/
-ImageView CreateImageView(const std::string& filename, unsigned int width, unsigned int height, Dali::FittingMode::Type fittingMode )
+ImageView CreateImageView(const std::string& filename, int width, int height, Dali::FittingMode::Type fittingMode )
{
- Image img = CreateImage( filename, width, height, fittingMode );
- ImageView actor = ImageView::New( img );
- actor.SetName( filename );
- actor.SetParentOrigin(ParentOrigin::CENTER);
- actor.SetAnchorPoint(AnchorPoint::CENTER);
- return actor;
+ ImageView imageView = ImageView::New();
+
+ Property::Map map;
+ map[Toolkit::ImageVisual::Property::URL] = filename;
+ map[Toolkit::ImageVisual::Property::DESIRED_WIDTH] = width;
+ map[Toolkit::ImageVisual::Property::DESIRED_HEIGHT] = height;
+ map[Toolkit::ImageVisual::Property::FITTING_MODE] = fittingMode;
+ imageView.SetProperty( Toolkit::ImageView::Property::IMAGE, map );
+
+ imageView.SetName( filename );
+ imageView.SetParentOrigin(ParentOrigin::CENTER);
+ imageView.SetAnchorPoint(AnchorPoint::CENTER);
+
+ return imageView;
}
/** Cycle the scaling mode options. */
Dali::FittingMode::Type newMode = NextMode( mFittingModes[id] );
const Vector2 imageSize = mSizes[actor.GetId()];
- const std::string& url = mResourceUrls[id];
- Image newImage = CreateImage( url, imageSize.width + 0.5f, imageSize.height + 0.5f, newMode );
ImageView imageView = ImageView::DownCast( actor );
- if(imageView)
+ if( imageView)
{
- imageView.SetImage( newImage );
+ Property::Map map;
+ map[Visual::Property::TYPE] = Visual::IMAGE;
+ map[ImageVisual::Property::URL] = mResourceUrls[id];
+ map[ImageVisual::Property::DESIRED_WIDTH] = imageSize.width + 0.5f;
+ map[ImageVisual::Property::DESIRED_HEIGHT] = imageSize.height + 0.5f;
+ map[ImageVisual::Property::FITTING_MODE] = newMode;
+ imageView.SetProperty( ImageView::Property::IMAGE, map );
}
+
mFittingModes[id] = newMode;
}
}
const Vector2 imageSize = mSizes[ id ];
Dali::FittingMode::Type newMode = NextMode( mFittingModes[ id ] );
- Image newImage = CreateImage( mResourceUrls[ id ], imageSize.width, imageSize.height, newMode );
- gridImageView.SetImage( newImage );
+
+ Property::Map map;
+ map[Visual::Property::TYPE] = Visual::IMAGE;
+ map[ImageVisual::Property::URL] = mResourceUrls[id];
+ map[ImageVisual::Property::DESIRED_WIDTH] = imageSize.width;
+ map[ImageVisual::Property::DESIRED_HEIGHT] = imageSize.height;
+ map[ImageVisual::Property::FITTING_MODE] = newMode;
+ gridImageView.SetProperty( ImageView::Property::IMAGE, map );
+
+
mFittingModes[ id ] = newMode;
namespace
{
- //Keeps information about each model for access.
- struct Model
- {
- Control control; // Control housing the mesh visual of the model.
- Vector2 rotation; // Keeps track of rotation about x and y axis for manual rotation.
- Animation rotationAnimation; // Automatically rotates when left alone.
- };
+// Keeps information about each model for access.
+struct Model
+{
+ Control control; // Control housing the mesh visual of the model.
+ Vector2 rotation; // Keeps track of rotation about x and y axis for manual rotation.
+ Animation rotationAnimation; // Automatically rotates when left alone.
+};
- //Files for meshes
- const char * const MODEL_FILE_TABLE[] =
- {
- DEMO_MODEL_DIR "Dino.obj",
- DEMO_MODEL_DIR "ToyRobot-Metal.obj",
- DEMO_MODEL_DIR "Toyrobot-Plastic.obj"
- };
+// Files for meshes
+const char * const MODEL_FILE_TABLE[] =
+{
+ DEMO_MODEL_DIR "Dino.obj",
+ DEMO_MODEL_DIR "ToyRobot-Metal.obj",
+ DEMO_MODEL_DIR "Toyrobot-Plastic.obj"
+};
- const char * const MATERIAL_FILE_TABLE[] =
- {
- DEMO_MODEL_DIR "Dino.mtl",
- DEMO_MODEL_DIR "ToyRobot-Metal.mtl",
- DEMO_MODEL_DIR "Toyrobot-Plastic.mtl"
- };
+const char * const MATERIAL_FILE_TABLE[] =
+{
+ DEMO_MODEL_DIR "Dino.mtl",
+ DEMO_MODEL_DIR "ToyRobot-Metal.mtl",
+ DEMO_MODEL_DIR "Toyrobot-Plastic.mtl"
+};
- const char * const TEXTURES_PATH( DEMO_IMAGE_DIR "" );
+const char * const TEXTURES_PATH( DEMO_IMAGE_DIR "" );
- //Possible shading modes.
- MeshVisual::ShadingMode::Value SHADING_MODE_TABLE[] =
- {
- MeshVisual::ShadingMode::TEXTURED_WITH_DETAILED_SPECULAR_LIGHTING,
- MeshVisual::ShadingMode::TEXTURED_WITH_SPECULAR_LIGHTING,
- MeshVisual::ShadingMode::TEXTURELESS_WITH_DIFFUSE_LIGHTING
- };
-
- //Button labels.
- const char * const PAUSE = " || ";
- const char * const PLAY = " > ";
- const char * const FIXED = "FIXED";
- const char * const MANUAL = "MANUAL";
- const char * const FRONT = "FRONT";
- const char * const BACK = "BACK";
-
- //Image urls for the light.
- const char * const LIGHT_URL_FRONT = DEMO_IMAGE_DIR "light-icon-front.png";
- const char * const LIGHT_URL_BACK = DEMO_IMAGE_DIR "light-icon-back.png";
-
- const float X_ROTATION_DISPLACEMENT_FACTOR = 60.0f;
- const float Y_ROTATION_DISPLACEMENT_FACTOR = 60.0f;
- const float MODEL_SCALE = 0.75f;
- const float LIGHT_SCALE = 0.15f;
- const float BUTTONS_OFFSET_BOTTOM = 0.08f;
- const float BUTTONS_OFFSET_SIDE = 0.2f;
- const int NUM_MESHES = 2;
-
- //Used to identify actors.
- const int MODEL_TAG = 0;
- const int LIGHT_TAG = 1;
- const int LAYER_TAG = 2;
-
-} //End namespace
+// Possible shading modes.
+MeshVisual::ShadingMode::Value SHADING_MODE_TABLE[] =
+{
+ MeshVisual::ShadingMode::TEXTURED_WITH_DETAILED_SPECULAR_LIGHTING,
+ MeshVisual::ShadingMode::TEXTURED_WITH_SPECULAR_LIGHTING,
+ MeshVisual::ShadingMode::TEXTURELESS_WITH_DIFFUSE_LIGHTING
+};
+
+// Button labels.
+const char * const PAUSE = " || ";
+const char * const PLAY = " > ";
+const char * const FIXED = "FIXED";
+const char * const MANUAL = "MANUAL";
+const char * const FRONT = "FRONT";
+const char * const BACK = "BACK";
+
+// Image urls for the light.
+const char * const LIGHT_URL_FRONT = DEMO_IMAGE_DIR "light-icon-front.png";
+const char * const LIGHT_URL_BACK = DEMO_IMAGE_DIR "light-icon-back.png";
+
+const float X_ROTATION_DISPLACEMENT_FACTOR = 60.0f;
+const float Y_ROTATION_DISPLACEMENT_FACTOR = 60.0f;
+const float MODEL_SCALE = 0.75f;
+const float LIGHT_SCALE = 0.15f;
+const float BUTTONS_OFFSET_BOTTOM = 0.08f;
+const float BUTTONS_OFFSET_SIDE = 0.2f;
+const int NUM_MESHES = 2;
+
+// Used to identify actors.
+const int MODEL_TAG = 0;
+const int LIGHT_TAG = 1;
+const int LAYER_TAG = 2;
+
+const Vector4 STAGE_COLOR( 211.0f / 255.0f, 211.0f / 255.0f, 211.0f / 255.0f, 1.0f ); ///< The color of the stage
+
+} // unnamed namespace
class MeshVisualController : public ConnectionTracker
{
{
// Get a handle to the stage
Stage stage = Stage::GetCurrent();
- stage.SetBackgroundColor( Vector4( 0.0, 0.5, 1.0, 1.0 ) );
+ stage.SetBackgroundColor( STAGE_COLOR );
//Set up root layer to receive touch gestures.
Layer rootLayer = stage.GetRootLayer();
// Demo setup parameters
//
-//#define MULTIPLE_MOTION_BLURRED_ACTORS
-#ifndef MULTIPLE_MOTION_BLURRED_ACTORS
-
const float MOTION_BLUR_ACTOR_WIDTH = 256; // actor size on screen
const float MOTION_BLUR_ACTOR_HEIGHT = 256; // ""
-
-#else //#ifndef MULTIPLE_MOTION_BLURRED_ACTORS
-
-const float MOTION_BLUR_ACTOR_WIDTH = 150; // actor size on screen
-const float MOTION_BLUR_ACTOR_HEIGHT = 112; // ""
-
-#endif //#ifndef MULTIPLE_MOTION_BLURRED_ACTORS
-
-
const unsigned int MOTION_BLUR_NUM_SAMPLES = 8;
const int MOTION_BLUR_NUM_ACTOR_IMAGES = 5;
// set actor shader to the blur one
Toolkit::SetMotionBlurProperties( mMotionBlurImageView, MOTION_BLUR_NUM_SAMPLES );
-
-#ifdef MULTIPLE_MOTION_BLURRED_ACTORS
-
- ///////////////////////////////////////////////////////
- //
- // Motion blurred actor 2
- //
-
- mMotionBlurImageView2 = ImageView::New(image);
- mMotionBlurImageView2.SetParentOrigin( ParentOrigin::CENTER );
- mMotionBlurImageView2.SetSize(mMotionBlurActorSize.x, mMotionBlurActorSize.y);
- mMotionBlurImageView2.SetPosition(mMotionBlurActorSize.x * 1.1f, 0.0f);
- mMotionBlurImageView.Add( mMotionBlurImageView2 );
-
- // set actor shader to the blur one
- Toolkit::SetMotionBlurProperties( mMotionBlurImageView2, MOTION_BLUR_NUM_SAMPLES );
- mMotionBlurImageView2.SetProperty( Toolkit::ImageView::Property::IMAGE, mMotionBlurEffect );
-
-
- ///////////////////////////////////////////////////////
- //
- // Motion blurred actor 3
- //
-
- mMotionBlurImageView3 = ImageView::New(image);
- mMotionBlurImageView3.SetParentOrigin( ParentOrigin::CENTER );
- mMotionBlurImageView3.SetSize(mMotionBlurActorSize.x, mMotionBlurActorSize.y);
- mMotionBlurImageView3.SetPosition(-mMotionBlurActorSize.x * 1.1f, 0.0f);
- mMotionBlurImageView.Add( mMotionBlurImageView3 );
-
- // set actor shader to the blur one
- Toolkit::SetMotionBlurProperties( mMotionBlurImageView3, MOTION_BLUR_NUM_SAMPLES );
- mMotionBlurImageView3.SetProperty( Toolkit::ImageView::Property::IMAGE, mMotionBlurEffect );
-
-
- ///////////////////////////////////////////////////////
- //
- // Motion blurred actor 4
- //
-
- mMotionBlurImageView4 = ImageView::New(image);
- mMotionBlurImageView4.SetParentOrigin( ParentOrigin::CENTER );
- mMotionBlurImageView4.SetSize(mMotionBlurActorSize.x, mMotionBlurActorSize.y);
- mMotionBlurImageView4.SetPosition(0.0f, mMotionBlurActorSize.y * 1.1f);
- mMotionBlurImageView.Add( mMotionBlurImageView4 );
-
- // set actor shader to the blur one
- Toolkit::SetMotionBlurProperties( mMotionBlurImageView4, MOTION_BLUR_NUM_SAMPLES );
- mMotionBlurImageView4.SetProperty( Toolkit::ImageView::Property::IMAGE, mMotionBlurEffect );
-
- ///////////////////////////////////////////////////////
- //
- // Motion blurred actor 5
- //
-
- mMotionBlurImageView5 = ImageView::New(image);
- mMotionBlurImageView5.SetParentOrigin( ParentOrigin::CENTER );
- mMotionBlurImageView5.SetSize(mMotionBlurActorSize.x, mMotionBlurActorSize.y);
- mMotionBlurImageView5.SetPosition(0.0f, -mMotionBlurActorSize.y * 1.1f);
- mMotionBlurImageView.Add( mMotionBlurImageView5 );
-
- // set actor shader to the blur one
- Toolkit::SetMotionBlurProperties( mMotionBlurImageView5, MOTION_BLUR_NUM_SAMPLES );
- mMotionBlurImageView5.SetProperty( Toolkit::ImageView::Property::IMAGE, mMotionBlurEffect );
-#endif //#ifdef MULTIPLE_MOTION_BLURRED_ACTORS
}
void Rotate( DeviceOrientation orientation )
}
SetImageFittedInBox( mMotionBlurImageView, mMotionBlurEffect, MOTION_BLUR_ACTOR_IMAGES[mCurrentImage], mMotionBlurActorSize.x, mMotionBlurActorSize.y );
-#ifdef MULTIPLE_MOTION_BLURRED_ACTORS
- mMotionBlurImageView2.SetImage(blurImage);
- mMotionBlurImageView3.SetImage(blurImage);
- mMotionBlurImageView4.SetImage(blurImage);
- mMotionBlurImageView5.SetImage(blurImage);
-#endif
}
ImageView mMotionBlurImageView;
Size mMotionBlurActorSize;
-#ifdef MULTIPLE_MOTION_BLURRED_ACTORS
- ImageView mMotionBlurImageView2;
- ImageView mMotionBlurImageView3;
- ImageView mMotionBlurImageView4;
- ImageView mMotionBlurImageView5;
-#endif //#ifdef MULTIPLE_MOTION_BLURRED_ACTORS
-
// animate actor to position where user taps screen
Animation mActorTapMovementAnimation;
varying mediump vec2 vTexCoord;\n
uniform sampler2D sTexture;\n
uniform mediump vec4 uColor;\n
- uniform mediump vec4 mixColor;\n
+ uniform mediump vec3 mixColor;\n
+ uniform mediump float opacity;\n
uniform mediump vec3 uChannels;\n
\n
void main()\n
{\n
- gl_FragColor = texture2D( sTexture, vTexCoord ) * mixColor * uColor * vec4(uChannels, 1.0) ;\n
+ gl_FragColor = texture2D( sTexture, vTexCoord ) * vec4(mixColor,opacity) * uColor * vec4(uChannels, 1.0) ;\n
}\n
);
for( int i=0; i<3; ++i )
{
std::ostringstream thumbnailName; thumbnailName << "thumbnail" << i+1;
- ImageView image = ImageView::New( ResourceImage::New( images[i] ) );
+ ImageView image = ImageView::New( images[i] );
image.SetName( thumbnailName.str() );
image.SetSize( DP(RADIO_LABEL_THUMBNAIL_SIZE), DP(RADIO_LABEL_THUMBNAIL_SIZE) );
{
}
- void operator()(Vector4& current, const PropertyInputContainer& inputs )
+ void operator()(Vector3& current, const PropertyInputContainer& inputs )
{
- current = hsv2rgb(Vector4(inputs[0]->GetFloat(), saturation, value, current.a));
+ current = hsv2rgb(Vector3(inputs[0]->GetFloat(), saturation, value));
}
- Vector4 hsv2rgb(Vector4 colorHSV)
+ Vector3 hsv2rgb(Vector3 colorHSV)
{
float r=colorHSV.z*(1+colorHSV.y*(cos(colorHSV.x)-1));
float g=colorHSV.z*(1+colorHSV.y*(cos(colorHSV.x-2.09439)-1));
float b=colorHSV.z*(1+colorHSV.y*(cos(colorHSV.x+2.09439)-1));
- return Vector4(r, g, b, colorHSV.a);
+ return Vector3(r, g, b);
}
float hue;
float saturation;
Renderer bgRenderer = mLabel.GetRendererAt(0);
mOverrideMixColorIndex = DevelHandle::GetPropertyIndex( bgRenderer, ColorVisual::Property::MIX_COLOR );
- Constraint constraint = Constraint::New<Vector4>( bgRenderer, mOverrideMixColorIndex, HSVColorConstraint(0.0f, 0.5f, 0.8f));
+ Constraint constraint = Constraint::New<Vector3>( bgRenderer, mOverrideMixColorIndex, HSVColorConstraint(0.0f, 0.5f, 0.8f));
constraint.AddSource( Source( mLabel, mHueAngleIndex ) );
constraint.SetRemoveAction( Constraint::Discard );
constraint.Apply();
// External includes
#include <dali-toolkit/dali-toolkit.h>
+#include <dali-toolkit/devel-api/controls/control-devel.h>
#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
#include <dali-toolkit/devel-api/visuals/text-visual-properties.h>
#include "shadow-button.h"
mShadowButton.SetAnchorPoint( AnchorPoint::CENTER );
mShadowButton.SetParentOrigin( ParentOrigin::CENTER );
mShadowButton.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
+ mShadowButton.SetProperty( DevelControl::Property::STATE, DevelControl::DISABLED );
+ mShadowButton.SetProperty( DevelControl::Property::SUB_STATE, "UNCHECKED" );
+
buttonLayout.AddChild( mShadowButton, TableView::CellPosition(1, 1) );
TableView actionButtonLayout = TableView::New( 1, NUMBER_OF_ACTION_BUTTONS+1 );
mActionButtons[i].ClickedSignal().Connect( this, &TransitionApplication::OnActionButtonClicked );
actionButtonLayout.AddChild( mActionButtons[i], TableView::CellPosition( 0, 1+i ) );
}
- SetLabelText( mActionButtons[0], "Activate" );
+ SetLabelText( mActionButtons[0], "Enable" );
SetLabelText( mActionButtons[1], "Check" );
mActionButtons[1].SetProperty( Button::Property::DISABLED, true );
mShadowButton.SetActiveState( ! activeState );
if( activeState )
{
- SetLabelText( button, "Activate" );
+ SetLabelText( button, "Enable" );
+ mShadowButton.SetProperty( DevelControl::Property::STATE, DevelControl::DISABLED );
}
else
{
- SetLabelText( button, "Deactivate" );
+ SetLabelText( button, "Disable" );
+ mShadowButton.SetProperty( DevelControl::Property::STATE, DevelControl::NORMAL );
}
mActionButtons[1].SetProperty( Button::Property::DISABLED, activeState );
break;
if( checkState )
{
SetLabelText( button, "Check" );
+ mShadowButton.SetProperty( DevelControl::Property::SUB_STATE, "UNCHECKED" );
}
else
{
SetLabelText( button, "Uncheck" );
+ mShadowButton.SetProperty( DevelControl::Property::SUB_STATE, "CHECKED" );
}
break;
}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "beat-control-impl.h"
+#include <dali-toolkit/dali-toolkit.h>
+#include <dali/public-api/object/type-registry-helper.h>
+#include <dali-toolkit/devel-api/align-enums.h>
+#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
+#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
+
+#include <cstdio>
+
+using namespace Dali; // Needed for macros
+using namespace Dali::Toolkit;
+
+namespace Demo
+{
+namespace Internal
+{
+
+namespace
+{
+
+const int BOUNCE_ANIMATION_RUNNING(0x0001);
+const int FADE_ANIMATION_RUNNING (0x0002);
+const int X_ANIMATION_RUNNING (0x0004);
+const int Y_ANIMATION_RUNNING (0x0008);
+
+
+Dali::BaseHandle Create()
+{
+ return Demo::BeatControl::New();
+}
+
+DALI_TYPE_REGISTRATION_BEGIN( BeatControl, Dali::Toolkit::Control, Create );
+
+DALI_PROPERTY_REGISTRATION( Demo, BeatControl, "bounceTransition", STRING, BOUNCE_TRANSITION );
+DALI_PROPERTY_REGISTRATION( Demo, BeatControl, "leftTransition", STRING, LEFT_TRANSITION );
+DALI_PROPERTY_REGISTRATION( Demo, BeatControl, "upTransition", STRING, UP_TRANSITION );
+DALI_PROPERTY_REGISTRATION( Demo, BeatControl, "fadeTransition", STRING, FADE_TRANSITION );
+DALI_PROPERTY_REGISTRATION( Demo, BeatControl, "beatVisual", MAP, BEAT_VISUAL );
+DALI_TYPE_REGISTRATION_END();
+
+
+Toolkit::TransitionData ConvertPropertyToTransition( const Property::Value& value )
+{
+ Toolkit::TransitionData transitionData;
+
+ if( value.GetType() == Property::ARRAY )
+ {
+ transitionData = Toolkit::TransitionData::New( *value.GetArray());
+ }
+ else if( value.GetType() == Property::MAP )
+ {
+ transitionData = Toolkit::TransitionData::New( *value.GetMap() );
+ }
+ return transitionData;
+}
+
+} // anonymous namespace
+
+
+Internal::BeatControl::BeatControl()
+: Control( ControlBehaviour( REQUIRES_STYLE_CHANGE_SIGNALS ) ),
+ mTransformSize(1.0f, 1.0f),
+ mAnimationPlaying(0)
+{
+}
+
+Internal::BeatControl::~BeatControl()
+{
+}
+
+Demo::BeatControl Internal::BeatControl::New()
+{
+ IntrusivePtr<Internal::BeatControl> impl = new Internal::BeatControl();
+ Demo::BeatControl handle = Demo::BeatControl( *impl );
+ impl->Initialize();
+ return handle;
+}
+
+
+void BeatControl::StartBounceAnimation()
+{
+ if( mAnimation )
+ {
+ mAnimation.Stop();
+ mAnimation.FinishedSignal().Disconnect( this, &BeatControl::OnBounceAnimationFinished );
+ OnBounceAnimationFinished(mAnimation);
+ }
+
+ mAnimation = CreateTransition( mBounceTransition );
+ mAnimation.FinishedSignal().Connect( this, &BeatControl::OnBounceAnimationFinished );
+ mAnimation.Play();
+ mAnimationPlaying |= BOUNCE_ANIMATION_RUNNING;
+}
+
+
+void BeatControl::StartXAnimation()
+{
+ if( mXAnimation )
+ {
+ mXAnimation.Stop();
+ mXAnimation.FinishedSignal().Disconnect( this, &BeatControl::OnXAnimationFinished );
+ OnXAnimationFinished(mXAnimation);
+ }
+
+ mXAnimation = CreateTransition( mLeftTransition );
+ mXAnimation.FinishedSignal().Connect( this, &BeatControl::OnXAnimationFinished );
+ mXAnimation.Play();
+ mAnimationPlaying |= X_ANIMATION_RUNNING;
+}
+
+void BeatControl::StartYAnimation()
+{
+ if( mYAnimation )
+ {
+ mYAnimation.Stop();
+ mYAnimation.FinishedSignal().Disconnect( this, &BeatControl::OnYAnimationFinished );
+ OnYAnimationFinished(mYAnimation);
+ }
+
+ mYAnimation = CreateTransition( mUpTransition );
+ mYAnimation.FinishedSignal().Connect( this, &BeatControl::OnYAnimationFinished );
+ mYAnimation.Play();
+ mAnimationPlaying |= Y_ANIMATION_RUNNING;
+}
+
+void BeatControl::StartFadeAnimation()
+{
+ if( mFadeAnimation )
+ {
+ mFadeAnimation.Stop();
+ mFadeAnimation.FinishedSignal().Disconnect( this, &BeatControl::OnFadeAnimationFinished );
+ OnFadeAnimationFinished(mFadeAnimation);
+ }
+
+ mFadeAnimation = CreateTransition( mFadeTransition );
+ mFadeAnimation.FinishedSignal().Connect( this, &BeatControl::OnFadeAnimationFinished );
+ mFadeAnimation.Play();
+ mAnimationPlaying |= FADE_ANIMATION_RUNNING;
+}
+
+void BeatControl::OnBounceAnimationFinished( Animation& src )
+{
+ mAnimationPlaying &= ~BOUNCE_ANIMATION_RUNNING;
+}
+void BeatControl::OnXAnimationFinished( Animation& src )
+{
+ mAnimationPlaying &= ~X_ANIMATION_RUNNING;
+}
+void BeatControl::OnYAnimationFinished( Animation& src )
+{
+ mAnimationPlaying &= ~Y_ANIMATION_RUNNING;
+}
+void BeatControl::OnFadeAnimationFinished( Animation& src )
+{
+ mAnimationPlaying &= ~FADE_ANIMATION_RUNNING;
+}
+
+void BeatControl::OnInitialize()
+{
+ Actor self = Self();
+}
+
+void BeatControl::OnStageConnection( int depth )
+{
+ Control::OnStageConnection( depth );
+}
+
+void BeatControl::OnStageDisconnection()
+{
+ Control::OnStageDisconnection();
+}
+
+void BeatControl::OnSizeSet( const Vector3& targetSize )
+{
+ Control::OnSizeSet( targetSize );
+ RelayoutVisuals( Vector2( targetSize ) );
+}
+
+void BeatControl::OnRelayout( const Vector2& targetSize, RelayoutContainer& container )
+{
+ RelayoutVisuals( targetSize );
+}
+
+void BeatControl::RelayoutVisuals( const Vector2& targetSize )
+{
+ if( mVisual )
+ {
+ if( (mAnimationPlaying & (X_ANIMATION_RUNNING | Y_ANIMATION_RUNNING)) == 0)
+ {
+ Vector2 size( targetSize );
+ Property::Map transformMap;
+ // Make the visual half the size of the control, but leave
+ // origin and anchor point at center, position is relative, but Zer0
+ transformMap[ DevelVisual::Transform::Property::SIZE ] = mTransformSize;
+ mVisual.SetTransformAndSize( transformMap, size );
+ }
+ }
+}
+
+Vector3 BeatControl::GetNaturalSize()
+{
+ if( mVisual )
+ {
+ Vector2 naturalSize;
+ mVisual.GetNaturalSize(naturalSize);
+ return Vector3(naturalSize);
+ }
+ return Vector3::ZERO;
+}
+
+void BeatControl::OnStyleChange( Toolkit::StyleManager styleManager, StyleChange::Type change )
+{
+ // Chain up.
+ Control::OnStyleChange( styleManager, change );
+}
+
+
+///////////////////////////////////////////////////////////
+//
+// Properties
+//
+
+void BeatControl::SetProperty( BaseObject* object, Property::Index index, const Property::Value& value )
+{
+ Demo::BeatControl beatControl = Demo::BeatControl::DownCast( Dali::BaseHandle( object ) );
+
+ if( beatControl )
+ {
+ BeatControl& impl = GetImpl( beatControl );
+ Actor self = impl.Self();
+ switch ( index )
+ {
+ case Demo::BeatControl::Property::BEAT_VISUAL:
+ {
+ bool sizeOnly = false;
+
+ // Determine if a transform.size property exists in the map, and
+ // save it.
+ Property::Map* map = value.GetMap();
+ if( map )
+ {
+ Property::Value* value = map->Find( DevelVisual::Property::TRANSFORM, "transform" );
+ if( value )
+ {
+ Property::Map* transformMap = value->GetMap();
+ if( transformMap )
+ {
+ Property::Value* sizeValue = transformMap->Find( DevelVisual::Transform::Property::SIZE, "size" );
+ if( sizeValue )
+ {
+ sizeValue->Get( impl.mTransformSize );
+ if( map->Count() == 1 && transformMap->Count() == 1 )
+ {
+ sizeOnly = true;
+ }
+ }
+ }
+ }
+ if( ! sizeOnly )
+ {
+ // Only register a visual if there is more than just a size setting
+ impl.mVisual = Toolkit::VisualFactory::Get().CreateVisual( *map );
+ impl.RegisterVisual( Demo::BeatControl::Property::BEAT_VISUAL, impl.mVisual );
+
+ // We have registered a new visual: must trigger size negotiation
+ // in order to call SetTransformAndSize on the visual with the right size:
+ impl.RelayoutRequest();
+ }
+ }
+ break;
+ }
+ case Demo::BeatControl::Property::BOUNCE_TRANSITION:
+ {
+ impl.mBounceTransition = ConvertPropertyToTransition( value );
+ break;
+ }
+ case Demo::BeatControl::Property::LEFT_TRANSITION:
+ {
+ impl.mLeftTransition = ConvertPropertyToTransition( value );
+ break;
+ }
+ case Demo::BeatControl::Property::UP_TRANSITION:
+ {
+ impl.mUpTransition = ConvertPropertyToTransition( value );
+ break;
+ }
+ case Demo::BeatControl::Property::FADE_TRANSITION:
+ {
+ impl.mFadeTransition = ConvertPropertyToTransition( value );
+ break;
+ }
+ }
+ }
+}
+
+Property::Value BeatControl::GetProperty( BaseObject* object, Property::Index propertyIndex )
+{
+ Property::Value value;
+
+ Demo::BeatControl beatControl = Demo::BeatControl::DownCast( Dali::BaseHandle( object ) );
+
+ if ( beatControl )
+ {
+ BeatControl& impl = GetImpl( beatControl );
+ switch ( propertyIndex )
+ {
+ case Demo::BeatControl::Property::BEAT_VISUAL:
+ {
+ if( impl.mVisual )
+ {
+ Property::Map map;
+ impl.mVisual.CreatePropertyMap(map);
+ value = map;
+ }
+ break;
+ }
+ case Demo::BeatControl::Property::BOUNCE_TRANSITION:
+ case Demo::BeatControl::Property::LEFT_TRANSITION:
+ case Demo::BeatControl::Property::UP_TRANSITION:
+ case Demo::BeatControl::Property::FADE_TRANSITION:
+ default:
+ break;
+ }
+ }
+
+ return value;
+}
+
+
+} // Internal
+} // Demo
--- /dev/null
+#ifndef DALI_DEMO_INTERNAL_BEAT_CONTROL_IMPL_H
+#define DALI_DEMO_INTERNAL_BEAT_CONTROL_IMPL_H
+
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "beat-control.h"
+#include <dali/public-api/animation/animation.h>
+#include <dali-toolkit/public-api/controls/control-impl.h>
+#include <dali-toolkit/devel-api/visual-factory/visual-base.h>
+#include <dali-toolkit/devel-api/visual-factory/transition-data.h>
+
+namespace Demo
+{
+
+namespace Internal // To use TypeRegistry, handle and body classes need the same name
+{
+
+class BeatControl : public Dali::Toolkit::Internal::Control
+{
+public:
+ /**
+ * Instantiate a new BeatControl object
+ */
+ static Demo::BeatControl New();
+ BeatControl();
+ ~BeatControl();
+
+public: // API
+ void StartBounceAnimation();
+
+ void StartXAnimation();
+
+ void StartYAnimation();
+
+ void StartFadeAnimation();
+
+public: // Properties
+ /**
+ * Called when a property of an object of this type is set.
+ * @param[in] object The object whose property is set.
+ * @param[in] index The property index.
+ * @param[in] value The new property value.
+ */
+ static void SetProperty( Dali::BaseObject* object, Dali::Property::Index index, const Dali::Property::Value& value );
+
+ /**
+ * Called to retrieve a property of an object of this type.
+ * @param[in] object The object whose property is to be retrieved.
+ * @param[in] index The property index.
+ * @return The current value of the property.
+ */
+ static Dali::Property::Value GetProperty( Dali::BaseObject* object, Dali::Property::Index propertyIndex );
+
+private: // From Control
+ /**
+ * @copydoc Toolkit::Control::OnInitialize()
+ */
+ virtual void OnInitialize();
+
+ /**
+ * @copydoc Toolkit::Control::OnStageConnect()
+ */
+ virtual void OnStageConnection( int depth );
+
+ /**
+ * @copydoc Toolkit::Control::OnStageDisconnection()
+ */
+ virtual void OnStageDisconnection();
+
+ /**
+ * @copydoc Toolkit::Control::OnSizeSet()
+ */
+ virtual void OnSizeSet( const Dali::Vector3& targetSize );
+
+ /**
+ * @copydoc Toolkit::Control::OnRelayout()
+ */
+ virtual void OnRelayout( const Dali::Vector2& targetSize, Dali::RelayoutContainer& container );
+ /**
+ * @copydoc Toolkit::Control::GetNaturalSize
+ */
+ virtual Dali::Vector3 GetNaturalSize();
+
+ /**
+ * @copydoc Toolkit::Control::OnStyleChange
+ */
+ virtual void OnStyleChange( Dali::Toolkit::StyleManager styleManager, Dali::StyleChange::Type change );
+
+private:
+ void OnBounceAnimationFinished( Dali::Animation& handle );
+ void OnXAnimationFinished( Dali::Animation& src );
+ void OnYAnimationFinished( Dali::Animation& src );
+ void OnFadeAnimationFinished( Dali::Animation& src );
+
+ /**
+ * Relayout the visuals as a result of size negotiation
+ */
+ void RelayoutVisuals( const Dali::Vector2& targetSize );
+
+private:
+ //undefined
+ BeatControl( const BeatControl& );
+ BeatControl& operator=( const BeatControl& );
+
+private:
+ // Implementation details
+ Dali::Toolkit::Visual::Base mVisual;
+ Dali::Toolkit::TransitionData mBounceTransition;
+ Dali::Toolkit::TransitionData mLeftTransition;
+ Dali::Toolkit::TransitionData mUpTransition;
+ Dali::Toolkit::TransitionData mFadeTransition;
+ Dali::Animation mAnimation;
+ Dali::Animation mXAnimation;
+ Dali::Animation mYAnimation;
+ Dali::Animation mFadeAnimation;
+ Dali::Vector2 mTransformSize;
+ int mAnimationPlaying;
+};
+
+} // Internal
+
+inline Internal::BeatControl& GetImpl( Demo::BeatControl& handle )
+{
+ DALI_ASSERT_ALWAYS( handle );
+ Dali::RefObject& object = handle.GetImplementation();
+ return static_cast<Internal::BeatControl&>(object);
+}
+
+inline const Internal::BeatControl& GetImpl( const Demo::BeatControl& handle )
+{
+ DALI_ASSERT_ALWAYS( handle );
+ const Dali::RefObject& object = handle.GetImplementation();
+ return static_cast<const Internal::BeatControl&>(object);
+}
+
+} // Demo
+
+#endif // DALI_DEMO_BEAT_CONTROL_IMPL_H
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "beat-control.h"
+#include "beat-control-impl.h"
+
+namespace Demo
+{
+
+BeatControl::BeatControl()
+{
+}
+
+BeatControl::BeatControl( const BeatControl& beatControl )
+: Control( beatControl )
+{
+}
+
+BeatControl& BeatControl::operator= ( const BeatControl& rhs )
+{
+ if( &rhs != this )
+ {
+ Control::operator=( rhs );
+ }
+ return *this;
+}
+
+BeatControl::~BeatControl()
+{
+}
+
+BeatControl BeatControl::New()
+{
+ BeatControl beatControl = Internal::BeatControl::New();
+ return beatControl;
+}
+
+BeatControl BeatControl::New( const std::string& url )
+{
+ BeatControl beatControl = Internal::BeatControl::New();
+ return beatControl;
+}
+
+BeatControl BeatControl::DownCast( BaseHandle handle )
+{
+ return Control::DownCast< BeatControl, Internal::BeatControl > ( handle );
+}
+
+void BeatControl::StartBounceAnimation()
+{
+ GetImpl(*this).StartBounceAnimation();
+}
+
+void BeatControl::StartXAnimation()
+{
+ GetImpl(*this).StartXAnimation();
+}
+void BeatControl::StartYAnimation()
+{
+ GetImpl(*this).StartYAnimation();
+}
+void BeatControl::StartFadeAnimation()
+{
+ GetImpl(*this).StartFadeAnimation();
+}
+
+BeatControl::BeatControl( Internal::BeatControl& implementation )
+: Control( implementation )
+{
+}
+
+BeatControl::BeatControl( Dali::Internal::CustomActor* internal )
+: Control( internal )
+{
+ VerifyCustomActorPointer< Internal::BeatControl >( internal ) ;
+}
+
+
+} //namespace Demo
--- /dev/null
+#ifndef DALI_DEMO_BEAT_CONTROL_H
+#define DALI_DEMO_BEAT_CONTROL_H
+
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <dali-toolkit/dali-toolkit.h>
+#include <string>
+
+namespace Demo
+{
+
+namespace Internal
+{
+// All type registered types need to have the same name for the body and the handle
+class BeatControl;
+}
+
+/**
+ * Control that allows the RGB channels of an image to be altered.
+ */
+class BeatControl : public Dali::Toolkit::Control
+{
+public:
+ /**
+ * The start and end property ranges for this control
+ */
+ enum PropertyRange
+ {
+ PROPERTY_START_INDEX = Dali::Toolkit::Control::CONTROL_PROPERTY_END_INDEX + 1,
+ PROPERTY_END_INDEX = PROPERTY_START_INDEX + 1000,
+ ANIMATABLE_PROPERTY_START_INDEX = Dali::ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX,
+ ANIMATABLE_PROPERTY_END_INDEX = ANIMATABLE_PROPERTY_START_INDEX+1000
+ };
+
+ struct Property
+ {
+ enum
+ {
+ BOUNCE_TRANSITION = PROPERTY_START_INDEX,
+ LEFT_TRANSITION,
+ UP_TRANSITION,
+ FADE_TRANSITION,
+ BEAT_VISUAL
+ };
+ };
+
+public: // Construction / destruction
+
+ /**
+ * Create an uninitialized handle
+ */
+ BeatControl();
+
+ /**
+ * Create a new image channel control without an image. Use
+ * SetImage to give this control an image
+ */
+ static BeatControl New();
+
+ /**
+ * Create a new image channel control from a given URL
+ */
+ static BeatControl New( const std::string& url );
+
+ /**
+ * Destructor. This is non-virtual since derived Handle types must not
+ * contain data or virtual methods
+ */
+ ~BeatControl();
+
+ /**
+ * Copy Constructor
+ */
+ BeatControl( const BeatControl& beatControl );
+
+ /**
+ * Assignment Operator
+ */
+ BeatControl& operator=( const BeatControl& beatControl );
+
+ /**
+ * Downcast
+ */
+ static BeatControl DownCast( BaseHandle handle );
+
+public: // API
+
+ void StartBounceAnimation();
+
+ void StartXAnimation();
+
+ void StartYAnimation();
+
+ void StartFadeAnimation();
+
+public: // Not for public use
+ /**
+ * Create a handle from an implementation
+ */
+ BeatControl( Internal::BeatControl& implementation );
+
+ /**
+ * Allow the creation of an BeatControl handle from an internal CustomActor pointer
+ */
+ BeatControl( Dali::Internal::CustomActor* internal );
+};
+
+} // namespace Demo
+
+#endif // DALI_DEMO_BEAT_CONTROL_H
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file transition-application.cpp
+ * @brief Application class for showing stylable transitions
+ */
+
+// Class include
+#include "transition-application.h"
+
+// External includes
+#include <dali-toolkit/dali-toolkit.h>
+#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
+#include <dali-toolkit/devel-api/visuals/text-visual-properties.h>
+#include "beat-control.h"
+#include <cstdio>
+#include <sstream>
+
+// Internal includes
+
+using namespace Dali;
+using namespace Dali::Toolkit;
+
+namespace Demo
+{
+
+const char* TransitionApplication::DEMO_THEME_ONE_PATH( DEMO_STYLE_DIR "style-example-theme-one.json" );
+const char* DALI_LOGO_PATH( DEMO_IMAGE_DIR "Logo-for-demo.png" );
+const char* DALI_ROBOT_MODEL_PATH( DEMO_MODEL_DIR "ToyRobot-Metal.obj" );
+const char* DALI_ROBOT_MATERIAL_PATH( DEMO_MODEL_DIR "ToyRobot-Metal.mtl" );
+
+
+TransitionApplication::TransitionApplication( Application& application )
+: mApplication( application ),
+ mTitle(),
+ mBeatControl(),
+ mActionButtons(),
+ mActionIndex( Property::INVALID_INDEX )
+{
+ application.InitSignal().Connect( this, &TransitionApplication::Create );
+}
+
+TransitionApplication::~TransitionApplication()
+{
+}
+
+void TransitionApplication::Create( Application& application )
+{
+ Stage stage = Stage::GetCurrent();
+ stage.KeyEventSignal().Connect(this, &TransitionApplication::OnKeyEvent);
+ stage.SetBackgroundColor( Vector4( 0.1f, 0.1f, 0.1f, 1.0f ) );
+
+ // Hide the indicator bar
+ application.GetWindow().ShowIndicator( Dali::Window::INVISIBLE );
+
+ // Content panes:
+ TableView contentLayout = TableView::New( 4, 1 );
+ contentLayout.SetName("ContentLayout");
+ contentLayout.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
+ contentLayout.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ contentLayout.SetParentOrigin( ParentOrigin::TOP_LEFT );
+ contentLayout.SetCellPadding( Vector2( 0.0f, 5.0f ) );
+
+ // Assign all rows the size negotiation property of fitting to children
+
+ stage.Add( contentLayout );
+
+ mTitle = TextLabel::New( "Custom Control Transition Example" );
+ mTitle.SetName( "Title" );
+ mTitle.SetStyleName("Title");
+ mTitle.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
+ mTitle.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
+ mTitle.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
+ contentLayout.Add( mTitle );
+ contentLayout.SetFitHeight(0); // Fill width
+
+ mBeatControl = BeatControl::New();
+ mBeatControl.SetName("BeatControl");
+ mBeatControl.SetProperty( BeatControl::Property::BEAT_VISUAL, Property::Map()
+ .Add( DevelVisual::Property::TRANSFORM, Property::Map()
+ .Add( DevelVisual::Transform::Property::SIZE, Vector2(0.5f, 0.5f) ) ) );
+
+ mBeatControl.SetAnchorPoint( AnchorPoint::CENTER );
+ mBeatControl.SetParentOrigin( ParentOrigin::CENTER );
+ mBeatControl.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
+ contentLayout.Add( mBeatControl );
+ // beat control should fill the tableview cell, so no change to default parameters
+
+ TableView visualTypeLayout = TableView::New( 1, NUMBER_OF_VISUAL_BUTTONS );
+ visualTypeLayout.SetName("VisualTypeLayout");
+ visualTypeLayout.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
+ visualTypeLayout.SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::HEIGHT );
+ visualTypeLayout.SetFitHeight( 0 );
+
+ contentLayout.Add( visualTypeLayout );
+ contentLayout.SetFitHeight(2);
+
+ for( int i=0; i<NUMBER_OF_VISUAL_BUTTONS; ++i )
+ {
+ Property::Map map;
+ CreateVisualMap( i, map );
+ map.Add( DevelVisual::Property::TRANSFORM, Property::Map()
+ .Add( DevelVisual::Transform::Property::SIZE, Vector2(0.8f, 0.8f) ) );
+ mVisualButtons[i] = BeatControl::New();
+ mVisualButtons[i].SetProperty( BeatControl::Property::BEAT_VISUAL, map );
+ mVisualButtons[i].SetName("VisualButton");
+ mVisualButtons[i].SetStyleName("VisualButton");
+ mVisualButtons[i].SetSize(0, 50);
+ mVisualButtons[i].SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
+ mVisualButtons[i].SetResizePolicy( ResizePolicy::FIXED, Dimension::HEIGHT );
+ mVisualIndex = mVisualButtons[i].RegisterProperty( "visualId", i, Property::READ_WRITE );
+ mVisualButtons[i].TouchSignal().Connect( this, &TransitionApplication::OnVisualButtonClicked );
+ visualTypeLayout.AddChild( mVisualButtons[i], TableView::CellPosition( 0, i ) );
+ }
+
+ TableView actionButtonLayout = TableView::New( 1, NUMBER_OF_ACTION_BUTTONS+1 );
+ actionButtonLayout.SetName("ThemeButtonsLayout");
+ actionButtonLayout.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
+ actionButtonLayout.SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::HEIGHT );
+ actionButtonLayout.SetFitHeight( 0 );
+
+ TextLabel label = TextLabel::New( "Action: ");
+ label.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
+ label.SetStyleName("ActionLabel");
+ actionButtonLayout.AddChild( label, TableView::CellPosition( 0, 0 ) );
+ actionButtonLayout.SetCellAlignment( TableView::CellPosition( 0, 0 ), HorizontalAlignment::LEFT, VerticalAlignment::CENTER );
+
+ for( int i=0; i<NUMBER_OF_ACTION_BUTTONS; ++i )
+ {
+ mActionButtons[i] = PushButton::New();
+ mActionButtons[i].SetName("ActionButton");
+ mActionButtons[i].SetStyleName("ActionButton");
+ mActionButtons[i].SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
+ mActionButtons[i].SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
+ mActionIndex = mActionButtons[i].RegisterProperty( "actionId", i, Property::READ_WRITE );
+ mActionButtons[i].ClickedSignal().Connect( this, &TransitionApplication::OnActionButtonClicked );
+ actionButtonLayout.AddChild( mActionButtons[i], TableView::CellPosition( 0, 1+i ) );
+ }
+ mActionButtons[0].SetLabelText( "Bounce" );
+ mActionButtons[1].SetLabelText( "X" );
+ mActionButtons[2].SetLabelText( "Y" );
+ mActionButtons[3].SetLabelText( "Fade" );
+
+ contentLayout.Add( actionButtonLayout );
+ contentLayout.SetFitHeight(3);
+}
+
+void TransitionApplication::CreateVisualMap( int index, Property::Map& map )
+{
+ switch(index)
+ {
+ case 0:
+ {
+ map[ Visual::Property::TYPE ] = Visual::COLOR;
+ map[ ColorVisual::Property::MIX_COLOR ] = Color::YELLOW;
+ break;
+ }
+ case 1:
+ {
+ map[ Visual::Property::TYPE ] = Visual::BORDER;
+ map[ BorderVisual::Property::COLOR ] = Color::GREEN;
+ map[ BorderVisual::Property::SIZE ] = 5;
+ break;
+ }
+ case 2:
+ {
+ map[ Visual::Property::TYPE ] = Visual::GRADIENT;
+
+ Property::Array stopOffsets;
+ stopOffsets.PushBack( 0.0f );
+ stopOffsets.PushBack( 0.3f );
+ stopOffsets.PushBack( 0.6f );
+ stopOffsets.PushBack( 0.8f );
+ stopOffsets.PushBack( 1.0f );
+ map[ GradientVisual::Property::STOP_OFFSET ] = stopOffsets;
+
+ Property::Array stopColors;
+ stopColors.PushBack( Vector4( 129.f, 198.f, 193.f, 255.f )/255.f );
+ stopColors.PushBack( Vector4( 196.f, 198.f, 71.f, 122.f )/255.f );
+ stopColors.PushBack( Vector4( 214.f, 37.f, 139.f, 191.f )/255.f );
+ stopColors.PushBack( Vector4( 129.f, 198.f, 193.f, 150.f )/255.f );
+ stopColors.PushBack( Color::YELLOW );
+ map[ GradientVisual::Property::STOP_COLOR ] = stopColors;
+ map[ GradientVisual::Property::START_POSITION ] = Vector2(-0.5f, -0.5f );
+ map[ GradientVisual::Property::END_POSITION ] = Vector2( 0.5f, 0.5f );
+ break;
+ }
+ case 3:
+ {
+ map[ Visual::Property::TYPE ] = Visual::IMAGE;
+ map[ ImageVisual::Property::URL ] = DALI_LOGO_PATH;
+ break;
+ }
+ case 4:
+ {
+ map[ Visual::Property::TYPE ] = Visual::IMAGE;
+ map[ ImageVisual::Property::URL ] = DEMO_IMAGE_DIR "preMultAlpha.png";
+ map[ DevelVisual::Property::PREMULTIPLIED_ALPHA ] = true;
+ break;
+ }
+
+ case 5:
+ {
+ map[ Visual::Property::TYPE ] = Visual::MESH;
+ map[ MeshVisual::Property::OBJECT_URL ] = DALI_ROBOT_MODEL_PATH;
+ map[ MeshVisual::Property::MATERIAL_URL ] = DALI_ROBOT_MATERIAL_PATH;
+ map[ MeshVisual::Property::TEXTURES_PATH ] = DEMO_IMAGE_DIR;
+ map[ MeshVisual::Property::SHADING_MODE ] = MeshVisual::ShadingMode::TEXTURED_WITH_DETAILED_SPECULAR_LIGHTING;
+ break;
+ }
+
+ case 6:
+ {
+ map[ Visual::Property::TYPE ] = Visual::PRIMITIVE;
+
+ map[ PrimitiveVisual::Property::SHAPE ] = PrimitiveVisual::Shape::BEVELLED_CUBE;
+ map[ PrimitiveVisual::Property::BEVEL_PERCENTAGE ] = 0.3f;
+ map[ PrimitiveVisual::Property::BEVEL_SMOOTHNESS ] = 0.0f;
+ map[ PrimitiveVisual::Property::SCALE_DIMENSIONS ] = Vector3(1.0f,1.0f,0.3f);
+ map[ PrimitiveVisual::Property::MIX_COLOR ] = Vector4(0.7f, 0.5f, 0.05f, 1.0f);
+
+ break;
+ }
+
+ case 7:
+ {
+ // NPatch
+ map[ Visual::Property::TYPE ] = Visual::IMAGE;
+ map[ ImageVisual::Property::URL ] = DEMO_IMAGE_DIR "button-up-16.9.png";
+ break;
+ }
+ case 8:
+ {
+ // SVG
+ map[ Visual::Property::TYPE ] = Visual::IMAGE;
+ map[ ImageVisual::Property::URL ] = DEMO_IMAGE_DIR "Kid1.svg";
+ break;
+ }
+
+ case 9:
+ {
+ map[ Visual::Property::TYPE ] = DevelVisual::TEXT;
+ map[ TextVisual::Property::TEXT ] = "Text";
+ map[ TextVisual::Property::TEXT_COLOR ] = Color::CYAN;
+ map[ TextVisual::Property::POINT_SIZE ] = 10;
+ break;
+ }
+
+ default:
+ {
+ map[ Visual::Property::TYPE ] = Visual::COLOR;
+ map[ ColorVisual::Property::MIX_COLOR ] = Color::MAGENTA;
+ break;
+ }
+ }
+}
+
+bool TransitionApplication::OnVisualButtonClicked( Actor actor, const TouchData& touchData )
+{
+ if( touchData.GetState(0) == PointState::FINISHED )
+ {
+ int visual = actor.GetProperty<int>( mVisualIndex );
+ Property::Map map;
+ CreateVisualMap( visual, map );
+ map.Add( DevelVisual::Property::TRANSFORM, Property::Map()
+ .Add( DevelVisual::Transform::Property::SIZE, Vector2( 0.5f, 0.5f ) ) );
+ mBeatControl.SetProperty( BeatControl::Property::BEAT_VISUAL, map );
+ }
+ return true;
+}
+
+bool TransitionApplication::OnActionButtonClicked( Button button )
+{
+ int action = button.GetProperty<int>( mActionIndex );
+ switch( action )
+ {
+ case 0:
+ {
+ mBeatControl.StartBounceAnimation();
+ break;
+ }
+ case 1:
+ {
+ mBeatControl.StartXAnimation();
+ break;
+ }
+ case 2:
+ {
+ mBeatControl.StartYAnimation();
+ break;
+ }
+ case 3:
+ {
+ mBeatControl.StartFadeAnimation();
+ break;
+ }
+ }
+
+ return true;
+}
+
+void TransitionApplication::OnKeyEvent( const KeyEvent& keyEvent )
+{
+ static int keyPressed = 0;
+
+ if( keyEvent.state == KeyEvent::Down)
+ {
+ if( keyPressed == 0 ) // Is this the first down event?
+ {
+ printf("Key pressed: %s %d\n", keyEvent.keyPressedName.c_str(), keyEvent.keyCode );
+
+ if( IsKey( keyEvent, DALI_KEY_ESCAPE) || IsKey( keyEvent, DALI_KEY_BACK ) )
+ {
+ mApplication.Quit();
+ }
+ else if( keyEvent.keyPressedName.compare("Return") == 0 )
+ {
+ }
+ }
+ keyPressed = 1;
+ }
+ else if( keyEvent.state == KeyEvent::Up )
+ {
+ keyPressed = 0;
+ }
+}
+
+} // namespace Demo
--- /dev/null
+#ifndef DALI_DEMO_TRANSITION_APPLICATION_H
+#define DALI_DEMO_TRANSITION_APPLICATION_H
+
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// External includes
+#include <dali-toolkit/dali-toolkit.h>
+//#include <dali-toolkit/devel-api/controls/slider/slider.h>
+#include <dali-toolkit/devel-api/controls/popup/popup.h>
+#include "beat-control.h"
+#include <cstdio>
+#include <sstream>
+
+// Internal includes
+
+using namespace Dali;
+using namespace Dali::Toolkit;
+
+namespace Demo
+{
+
+class TransitionApplication : public ConnectionTracker
+{
+public:
+ static const int NUMBER_OF_ACTION_BUTTONS=4;
+ static const int NUMBER_OF_VISUAL_BUTTONS=10;
+
+public:
+ // Constructor
+ TransitionApplication( Application& application );
+
+ // Destructor
+ ~TransitionApplication();
+
+ // Init signal handler
+ void Create( Application& application );
+
+ // Create the GUI components
+ Toolkit::TextLabel CreateTitle( std::string title );
+ Actor CreateContentPane();
+
+ // Key event handler
+ void OnKeyEvent( const KeyEvent& event );
+
+ bool OnActionButtonClicked( Button button );
+ bool OnVisualButtonClicked( Actor actor, const TouchData& touchData );
+
+ static const char* DEMO_THEME_ONE_PATH;
+
+private:
+
+ /** Create a visual map
+ *
+ * @param[in] index The index of the visual to create
+ * @param[out] map The map to generate
+ */
+ void CreateVisualMap( int index, Property::Map& map );
+
+ Application& mApplication;
+ TextLabel mTitle;
+ BeatControl mBeatControl;
+ PushButton mActionButtons[NUMBER_OF_ACTION_BUTTONS];
+ BeatControl mVisualButtons[NUMBER_OF_VISUAL_BUTTONS];
+ Property::Index mVisualIndex;
+ Property::Index mActionIndex;
+};
+
+} // Namespace Demo
+
+
+#endif // DALI_DEMO_TRANSITION_APPLICATION_H
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file transition-example.cpp
+ * @brief Example of stylable transitions.
+ */
+
+// External includes
+#include <dali/dali.h>
+
+// Internal includes
+#include "transition-application.h"
+
+
+/// Entry point for applications
+int DALI_EXPORT_API main( int argc, char** argv )
+{
+ const char* themeName = Demo::TransitionApplication::DEMO_THEME_ONE_PATH;
+
+ Application application = Application::New( &argc, &argv, themeName );
+ Demo::TransitionApplication transitionApplication( application );
+ application.MainLoop();
+ return 0;
+}
Name: com.samsung.dali-demo
Summary: The OpenGLES Canvas Core Demo
-Version: 1.2.27
+Version: 1.2.28
Release: 1
Group: System/Libraries
License: Apache-2.0
[
{
"target":"imageVisual",
- "property":"mixColor",
- "initialValue":[1,1,1,0],
- "targetValue":[1,1,1,1],
+ "property":"opacity",
+ "initialValue":0,
+ "targetValue":1,
"animator":
{
"alphaFunction":"EASE_IN_OUT",
[
{
"target":"imageVisual",
- "property":"mixColor",
- "targetValue":[1,1,1,0],
+ "property":"opacity",
+ "targetValue":0,
"animator":
{
"alphaFunction":"EASE_IN_OUT",
},
"ShadowButton":
{
- "backgroundVisual":{
- "visualType":"IMAGE",
- "url":"{STYLE_DIR}/images/shadowButtonBg.9.png",
- "mixColor":[1,1,1,0]
- },
- "checkboxBgVisual":{
- "visualType":"IMAGE",
- "url":"{STYLE_DIR}/images/CheckBg.png",
- "transform":{
- "size":[0.09, 0.28],
- "offset":[30,0],
- "offsetSizeMode":[1,1,0,0],
- "origin":"CENTER_BEGIN",
- "anchorPoint":"CENTER_BEGIN"
- }
- },
- "checkboxFgVisual":{
- "visualType":"IMAGE",
- "url":"{STYLE_DIR}/images/Tick.png",
- "transform":{
- "size":[0.09, 0.28],
- "offset":[30,0],
- "offsetSizeMode":[1,1,0,0],
- "origin":"CENTER_BEGIN",
- "anchorPoint":"CENTER_BEGIN"
- }
- },
- "labelVisual":{
- "visualType":"TEXT",
- "text":"Don't show again",
- "pointSize":8,
- "horizontalAlignment":"END",
- "verticalAlignment":"CENTER",
- "textColor":[1,1,1,1],
- "mixColor":[0.3, 0.3, 0.3, 1],
- "transform":{
- "size":[0.9, 0.9],
- "offset":[-30,0],
- "offsetSizeMode":[1,1,0,0],
- "origin":"CENTER_END",
- "anchorPoint":"CENTER_END"
- }
- },
- "activeTransition":
- [
+ "states":
+ {
+ "NORMAL":
{
- "target":"checkboxBgVisual",
- "property":"size",
- "initialValue":[0.09, 0.28],
- "targetValue":[0.12, 0.37],
- "animator":
+ "visuals":
{
- "alphaFunction":"EASE_OUT_BACK",
- "timePeriod":
- {
- "duration":0.8,
- "delay":0
+ "backgroundVisual":{
+ "visualType":"IMAGE",
+ "url":"{STYLE_DIR}/images/shadowButtonBg.9.png"
+ },
+
+ "checkboxBgVisual":{
+ "visualType":"IMAGE",
+ "url":"{STYLE_DIR}/images/CheckBg.png",
+ "transform":{
+ "size":[0.09, 0.28],
+ "offset":[30,0],
+ "offsetSizeMode":[1,1,0,0],
+ "origin":"CENTER_BEGIN",
+ "anchorPoint":"CENTER_BEGIN"
+ }
+ },
+
+ "labelVisual":{
+ "visualType":"TEXT",
+ "text":"Don't show again",
+ "pointSize":8,
+ "horizontalAlignment":"END",
+ "verticalAlignment":"CENTER",
+ "textColor":[1,1,1,1],
+ "mixColor":[0, 0, 0, 1],
+ "transform":{
+ "size":[0.9, 0.9],
+ "offset":[-30,0],
+ "offsetSizeMode":[1,1,0,0],
+ "origin":"CENTER_END",
+ "anchorPoint":"CENTER_END"
+ }
}
- }
- },
- {
- "target":"backgroundVisual",
- "property":"mixColor",
- "initialValue":[1,1,1,0],
- "targetValue":[1,1,1,1],
- "animator":
+ },
+
+ "states":
{
- "alphaFunction":"EASE_OUT_BACK",
- "timePeriod":
+ "CHECKED":
{
- "duration":0.8,
- "delay":0
- }
- }
- },
- {
- "target":"backgroundVisual",
- "property":"size",
- "initialValue":[0.9, 0.9],
- "targetValue":[1, 1],
- "animator":
- {
- "alphaFunction":"EASE_OUT_BACK",
- "timePeriod":
- {
- "duration":0.8,
- "delay":0
- }
- }
- },
- {
- "target":"checkboxFgVisual",
- "property":"size",
- "initialValue":[0.09, 0.28],
- "targetValue":[0.12, 0.37],
- "animator":
- {
- "alphaFunction":"EASE_OUT_BACK",
- "timePeriod":
+ "visuals":
+ {
+ "checkboxFgVisual":{
+ "visualType":"IMAGE",
+ "url":"{STYLE_DIR}/images/Tick.png",
+ "transform":{
+ "size":[0.09, 0.28],
+ "offset":[30,0],
+ "offsetSizeMode":[1,1,0,0],
+ "origin":"CENTER_BEGIN",
+ "anchorPoint":"CENTER_BEGIN"
+ }
+ }
+ },
+ "entryTransition":
+ [
+ {
+ "target":"checkboxFgVisual",
+ "property":"pixelArea",
+ "initialValue":[0.0, 0.0, 0.0, 1.0],
+ "targetValue":[0.0, 0.0, 1.0, 1.0],
+ "animator":
+ {
+ "alphaFunction":"EASE_IN",
+ "timePeriod":
+ {
+ "duration":0.4,
+ "delay":0
+ }
+ }
+ },
+ {
+ "target":"checkboxFgVisual",
+ "property":"size",
+ "initialValue":[0.0, 0.37],
+ "targetValue":[0.12, 0.37],
+ "animator":
+ {
+ "alphaFunction":"EASE_IN",
+ "timePeriod":
+ {
+ "duration":0.4,
+ "delay":0
+ }
+ }
+ }
+ ],
+ "exitTransition":
+ [
+ {
+ "target":"checkboxFgVisual",
+ "property":"pixelArea",
+ "initialValue":[0.0, 0.0, 1.0, 1.0],
+ "targetValue":[0.0, 0.0, 0.0, 1.0],
+ "animator":
+ {
+ "alphaFunction":"EASE_OUT",
+ "timePeriod":
+ {
+ "duration":0.4,
+ "delay":0
+ }
+ }
+ },
+ {
+ "target":"checkboxFgVisual",
+ "property":"size",
+ "targetValue":[0.0, 0.37],
+ "animator":
+ {
+ "alphaFunction":"EASE_OUT",
+ "timePeriod":
+ {
+ "duration":0.4,
+ "delay":0
+ }
+ }
+ }
+ ]
+ },
+ "UNCHECKED":
{
- "duration":0.8,
- "delay":0
}
}
},
+ //"FOCUSED"
+ "DISABLED":
{
- "target":"labelVisual",
- "property":"mixColor",
- "initialValue":[0.2, 0.2, 0.2, 1.0],
- "targetValue":[0, 0, 0, 1],
- "animator":
+ "visuals":
{
- "alphaFunction":"EASE_OUT_BACK",
- "timePeriod":
- {
- "duration":0.8,
- "delay":0
+ "checkboxBgVisual":{
+ "visualType":"IMAGE",
+ "url":"{STYLE_DIR}/images/CheckBg.png",
+ "transform":{
+ "size":[0.09, 0.28],
+ "offset":[30,0],
+ "offsetSizeMode":[1,1,0,0],
+ "origin":"CENTER_BEGIN",
+ "anchorPoint":"CENTER_BEGIN"
+ }
+ },
+
+ "checkboxFgVisual":{
+ "visualType":"IMAGE",
+ "url":"{STYLE_DIR}/images/Tick.png",
+ "transform":{
+ "size":[0.09, 0.28],
+ "offset":[30,0],
+ "offsetSizeMode":[1,1,0,0],
+ "origin":"CENTER_BEGIN",
+ "anchorPoint":"CENTER_BEGIN"
+ }
+ },
+
+ "labelVisual":{
+ "visualType":"TEXT",
+ "text":"Don't show again",
+ "pointSize":8,
+ "horizontalAlignment":"END",
+ "verticalAlignment":"CENTER",
+ "textColor":[1,1,1,1],
+ "mixColor":[0.3, 0.3, 0.3, 1],
+ "transform":{
+ "size":[0.9, 0.9],
+ "offset":[-30,0],
+ "offsetSizeMode":[1,1,0,0],
+ "origin":"CENTER_END",
+ "anchorPoint":"CENTER_END"
+ }
}
}
}
- ],
- "inactiveTransition":
+ },
+ "transitions":
[
{
- "target":"checkboxBgVisual",
- "property":"size",
- "initialValue":[0.12, 0.37],
- "targetValue":[0.09, 0.28],
+ "from":"DISABLED",
+ "to":"NORMAL",
+ "visualName":"backgroundVisual",
+ "effect":"FADE_IN",
"animator":
{
"alphaFunction":"EASE_OUT_BACK",
- "timePeriod":
- {
- "duration":0.8,
- "delay":0
- }
+ "duration":0.8
}
},
{
- "target":"backgroundVisual",
- "property":"mixColor",
- "targetValue":[1,1,1,0],
+ "from":"DISABLED",
+ "to":"NORMAL",
+ "visualName":"*",
"animator":
{
"alphaFunction":"EASE_OUT_BACK",
- "timePeriod":
- {
- "duration":0.8,
- "delay":0
- }
+ "duration":0.8
}
},
{
- "target":"checkboxFgVisual",
- "property":"size",
- "initialValue":[0.12, 0.37],
- "targetValue":[0.09, 0.28],
+ "from":"NORMAL",
+ "to":"DISABLED",
+ "visualName":"backgroundVisual",
+ "effect":"FADE_OUT",
"animator":
{
"alphaFunction":"EASE_OUT_BACK",
- "timePeriod":
- {
- "duration":0.8,
- "delay":0
- }
+ "duration":0.8
}
},
{
- "target":"labelVisual",
- "property":"mixColor",
- "targetValue":[0.4, 0.4, 0.4, 1.0],
+ "from":"NORMAL",
+ "to":"DISABLED",
+ "visualName":"*",
"animator":
{
"alphaFunction":"EASE_OUT_BACK",
- "timePeriod":
- {
- "duration":0.8,
- "delay":0
- }
+ "duration":0.8
}
- },
+ }
+ ]
+ },
+ "BeatControl":
+ {
+ "beatVisual":{
+ "visualType":"IMAGE",
+ "url":"{APPLICATION_RESOURCE_PATH}/images/Logo-for-demo.png"
+ },
+
+ "bounceTransition":
+ [
{
- "target":"backgroundVisual",
+ "target":"beatVisual",
"property":"size",
- "targetValue":[0.9, 0.9],
+ "initialValue":[0.5, 0.5],
+ "targetValue":[0.75, 0.75],
"animator":
{
- "alphaFunction":"EASE_OUT_BACK",
+ "alphaFunction":"BOUNCE",
"timePeriod":
{
- "duration":0.8,
+ "duration":0.5,
"delay":0
}
}
}
],
- "checkTransition":
+
+ "leftTransition":
[
{
- "target":"checkboxFgVisual",
- "property":"pixelArea",
- "initialValue":[0.0, 0.0, 0.0, 1.0],
- "targetValue":[0.0, 0.0, 1.0, 1.0],
- "animator":
- {
- "alphaFunction":"EASE_IN",
- "timePeriod":
- {
- "duration":0.4,
- "delay":0
- }
- }
- },
- {
- "target":"checkboxFgVisual",
- "property":"size",
- "initialValue":[0.0, 0.37],
- "targetValue":[0.12, 0.37],
+ "target":"beatVisual",
+ "property":"offset",
+ "initialValue":[0, 0],
+ "targetValue":[0.25, 0],
"animator":
{
- "alphaFunction":"EASE_IN",
+ "alphaFunction":"BOUNCE",
"timePeriod":
{
- "duration":0.4,
+ "duration":0.5,
"delay":0
}
}
}
],
- "uncheckTransition":
+
+ "upTransition":
[
{
- "target":"checkboxFgVisual",
- "property":"pixelArea",
- "initialValue":[0.0, 0.0, 1.0, 1.0],
- "targetValue":[0.0, 0.0, 0.0, 1.0],
+ "target":"beatVisual",
+ "property":"offset",
+ "initialValue":[0, 0],
+ "targetValue":[0, 0.25],
"animator":
{
- "alphaFunction":"EASE_OUT",
+ "alphaFunction":"BOUNCE",
"timePeriod":
{
- "duration":0.4,
+ "duration":0.5,
"delay":0
}
}
- },
+ }
+ ],
+
+ "fadeTransition":
+ [
{
- "target":"checkboxFgVisual",
- "property":"size",
- "targetValue":[0.0, 0.37],
+ "target":"beatVisual",
+ "property":"opacity",
+ "targetValue":0,
"animator":
{
- "alphaFunction":"EASE_OUT",
+ "alphaFunction":"BOUNCE",
"timePeriod":
{
- "duration":0.4,
+ "duration":0.8,
"delay":0
}
}
[
{
"target":"imageVisual",
- "property":"mixColor",
- "initialValue":[1,1,1,0],
- "targetValue":[1,1,1,1],
+ "property":"opacity",
+ "initialValue":0,
+ "targetValue":1,
"animator":
{
"alphaFunction":"EASE_IN_OUT",
[
{
"target":"imageVisual",
- "property":"mixColor",
- "targetValue":[1,1,1,0],
+ "property":"opacity",
+ "targetValue":0,
"animator":
{
"alphaFunction":"EASE_IN_OUT",
},
"ShadowButton":
{
- "backgroundVisual":{
- "visualType":"IMAGE",
- "url":"{STYLE_DIR}/images/shadowButtonBg.9.png",
- "mixColor":[1,1,1,0]
- },
- "checkboxBgVisual":{
- "visualType":"IMAGE",
- "url":"{STYLE_DIR}/images/CheckBg.png",
- "transform":{
- "size":[0.09, 0.28],
- "offset":[30,0],
- "offsetSizeMode":[1,1,0,0],
- "origin":"CENTER_BEGIN",
- "anchorPoint":"CENTER_BEGIN"
- }
- },
- "checkboxFgVisual":{
- "visualType":"IMAGE",
- "url":"{STYLE_DIR}/images/Tick.png",
- "transform":{
- "size":[0.09, 0.28],
- "offset":[30,0],
- "offsetSizeMode":[1,1,0,0],
- "origin":"CENTER_BEGIN",
- "anchorPoint":"CENTER_BEGIN"
- }
- },
- "labelVisual":{
- "visualType":"TEXT",
- "text":"Don't show again",
- "pointSize":20,
- "horizontalAlignment":"END",
- "verticalAlignment":"CENTER",
- "textColor":[1,1,1,1],
- "mixColor":[0.3, 0.3, 0.3, 1],
- "transform":{
- "size":[0.9, 0.9],
- "offset":[-30,0],
- "offsetSizeMode":[1,1,0,0],
- "origin":"CENTER_END",
- "anchorPoint":"CENTER_END"
- }
- },
- "activeTransition":
- [
+ "states":
+ {
+ "NORMAL":
{
- "target":"checkboxBgVisual",
- "property":"size",
- "initialValue":[0.09, 0.28],
- "targetValue":[0.12, 0.37],
- "animator":
+ "visuals":
{
- "alphaFunction":"EASE_OUT_BACK",
- "timePeriod":
- {
- "duration":0.8,
- "delay":0
+ "backgroundVisual":{
+ "visualType":"IMAGE",
+ "url":"{STYLE_DIR}/images/shadowButtonBg.9.png"
+ },
+
+ "checkboxBgVisual":{
+ "visualType":"IMAGE",
+ "url":"{STYLE_DIR}/images/CheckBg.png",
+ "transform":{
+ "size":[0.09, 0.28],
+ "offset":[30,0],
+ "offsetSizeMode":[1,1,0,0],
+ "origin":"CENTER_BEGIN",
+ "anchorPoint":"CENTER_BEGIN"
+ }
+ },
+
+ "labelVisual":{
+ "visualType":"TEXT",
+ "text":"Don't show again",
+ "pointSize":20,
+ "horizontalAlignment":"END",
+ "verticalAlignment":"CENTER",
+ "textColor":[1,1,1,1],
+ "mixColor":[0, 0, 0, 1],
+ "transform":{
+ "size":[0.9, 0.9],
+ "offset":[-30,0],
+ "offsetSizeMode":[1,1,0,0],
+ "origin":"CENTER_END",
+ "anchorPoint":"CENTER_END"
+ }
}
- }
- },
- {
- "target":"backgroundVisual",
- "property":"mixColor",
- "initialValue":[1,1,1,0],
- "targetValue":[1,1,1,1],
- "animator":
+ },
+
+ "states":
{
- "alphaFunction":"EASE_OUT_BACK",
- "timePeriod":
+ "CHECKED":
{
- "duration":0.8,
- "delay":0
- }
- }
- },
- {
- "target":"backgroundVisual",
- "property":"size",
- "initialValue":[0.9, 0.9],
- "targetValue":[1, 1],
- "animator":
- {
- "alphaFunction":"EASE_OUT_BACK",
- "timePeriod":
- {
- "duration":0.8,
- "delay":0
- }
- }
- },
- {
- "target":"checkboxFgVisual",
- "property":"size",
- "initialValue":[0.09, 0.28],
- "targetValue":[0.12, 0.37],
- "animator":
- {
- "alphaFunction":"EASE_OUT_BACK",
- "timePeriod":
+ "visuals":
+ {
+ "checkboxFgVisual":{
+ "visualType":"IMAGE",
+ "url":"{STYLE_DIR}/images/Tick.png",
+ "transform":{
+ "size":[0.09, 0.28],
+ "offset":[30,0],
+ "offsetSizeMode":[1,1,0,0],
+ "origin":"CENTER_BEGIN",
+ "anchorPoint":"CENTER_BEGIN"
+ }
+ }
+ },
+ "entryTransition":
+ [
+ {
+ "target":"checkboxFgVisual",
+ "property":"pixelArea",
+ "initialValue":[0.0, 0.0, 0.0, 1.0],
+ "targetValue":[0.0, 0.0, 1.0, 1.0],
+ "animator":
+ {
+ "alphaFunction":"EASE_IN",
+ "timePeriod":
+ {
+ "duration":0.4,
+ "delay":0
+ }
+ }
+ },
+ {
+ "target":"checkboxFgVisual",
+ "property":"size",
+ "initialValue":[0.0, 0.37],
+ "targetValue":[0.12, 0.37],
+ "animator":
+ {
+ "alphaFunction":"EASE_IN",
+ "timePeriod":
+ {
+ "duration":0.4,
+ "delay":0
+ }
+ }
+ }
+ ],
+ "exitTransition":
+ [
+ {
+ "target":"checkboxFgVisual",
+ "property":"pixelArea",
+ "initialValue":[0.0, 0.0, 1.0, 1.0],
+ "targetValue":[0.0, 0.0, 0.0, 1.0],
+ "animator":
+ {
+ "alphaFunction":"EASE_OUT",
+ "timePeriod":
+ {
+ "duration":0.4,
+ "delay":0
+ }
+ }
+ },
+ {
+ "target":"checkboxFgVisual",
+ "property":"size",
+ "targetValue":[0.0, 0.37],
+ "animator":
+ {
+ "alphaFunction":"EASE_OUT",
+ "timePeriod":
+ {
+ "duration":0.4,
+ "delay":0
+ }
+ }
+ }
+ ]
+ },
+ "UNCHECKED":
{
- "duration":0.8,
- "delay":0
}
}
},
+ //"FOCUSED"
+ "DISABLED":
{
- "target":"labelVisual",
- "property":"mixColor",
- "initialValue":[0.2, 0.2, 0.2, 1.0],
- "targetValue":[0, 0, 0, 1],
- "animator":
+ "visuals":
{
- "alphaFunction":"EASE_OUT_BACK",
- "timePeriod":
- {
- "duration":0.8,
- "delay":0
+ "checkboxBgVisual":{
+ "visualType":"IMAGE",
+ "url":"{STYLE_DIR}/images/CheckBg.png",
+ "transform":{
+ "size":[0.09, 0.28],
+ "offset":[30,0],
+ "offsetSizeMode":[1,1,0,0],
+ "origin":"CENTER_BEGIN",
+ "anchorPoint":"CENTER_BEGIN"
+ }
+ },
+
+ "checkboxFgVisual":{
+ "visualType":"IMAGE",
+ "url":"{STYLE_DIR}/images/Tick.png",
+ "transform":{
+ "size":[0.09, 0.28],
+ "offset":[30,0],
+ "offsetSizeMode":[1,1,0,0],
+ "origin":"CENTER_BEGIN",
+ "anchorPoint":"CENTER_BEGIN"
+ }
+ },
+
+ "labelVisual":{
+ "visualType":"TEXT",
+ "text":"Don't show again",
+ "pointSize":20,
+ "horizontalAlignment":"END",
+ "verticalAlignment":"CENTER",
+ "textColor":[1,1,1,1],
+ "mixColor":[0.3, 0.3, 0.3, 1],
+ "transform":{
+ "size":[0.9, 0.9],
+ "offset":[-30,0],
+ "offsetSizeMode":[1,1,0,0],
+ "origin":"CENTER_END",
+ "anchorPoint":"CENTER_END"
+ }
}
}
}
- ],
- "inactiveTransition":
+ },
+ "transitions":
[
{
- "target":"checkboxBgVisual",
- "property":"size",
- "initialValue":[0.12, 0.37],
- "targetValue":[0.09, 0.28],
+ "from":"DISABLED",
+ "to":"NORMAL",
+ "visualName":"backgroundVisual",
+ "effect":"FADE_IN",
"animator":
{
"alphaFunction":"EASE_OUT_BACK",
- "timePeriod":
- {
- "duration":0.8,
- "delay":0
- }
+ "duration":0.8
}
},
{
- "target":"backgroundVisual",
- "property":"mixColor",
- "targetValue":[1,1,1,0],
+ "from":"DISABLED",
+ "to":"NORMAL",
+ "visualName":"*",
"animator":
{
"alphaFunction":"EASE_OUT_BACK",
- "timePeriod":
- {
- "duration":0.8,
- "delay":0
- }
+ "duration":0.8
}
},
{
- "target":"checkboxFgVisual",
- "property":"size",
- "initialValue":[0.12, 0.37],
- "targetValue":[0.09, 0.28],
+ "from":"NORMAL",
+ "to":"DISABLED",
+ "visualName":"backgroundVisual",
+ "effect":"FADE_OUT",
"animator":
{
"alphaFunction":"EASE_OUT_BACK",
- "timePeriod":
- {
- "duration":0.8,
- "delay":0
- }
+ "duration":0.8
}
},
{
- "target":"labelVisual",
- "property":"mixColor",
- "targetValue":[0.4, 0.4, 0.4, 1.0],
+ "from":"NORMAL",
+ "to":"DISABLED",
+ "visualName":"*",
"animator":
{
"alphaFunction":"EASE_OUT_BACK",
- "timePeriod":
- {
- "duration":0.8,
- "delay":0
- }
+ "duration":0.8
}
- },
+ }
+ ]
+ },
+ "BeatControl":
+ {
+ "beatVisual":{
+ "visualType":"IMAGE",
+ "url":"{APPLICATION_RESOURCE_PATH}/images/Logo-for-demo.png"
+ },
+
+ "bounceTransition":
+ [
{
- "target":"backgroundVisual",
+ "target":"beatVisual",
"property":"size",
- "targetValue":[0.9, 0.9],
+ "initialValue":[0.5, 0.5],
+ "targetValue":[0.75, 0.75],
"animator":
{
- "alphaFunction":"EASE_OUT_BACK",
+ "alphaFunction":"BOUNCE",
"timePeriod":
{
- "duration":0.8,
+ "duration":0.5,
"delay":0
}
}
}
],
- "checkTransition":
+
+ "leftTransition":
[
{
- "target":"checkboxFgVisual",
- "property":"pixelArea",
- "initialValue":[0.0, 0.0, 0.0, 1.0],
- "targetValue":[0.0, 0.0, 1.0, 1.0],
- "animator":
- {
- "alphaFunction":"EASE_IN",
- "timePeriod":
- {
- "duration":0.4,
- "delay":0
- }
- }
- },
- {
- "target":"checkboxFgVisual",
- "property":"size",
- "initialValue":[0.0, 0.37],
- "targetValue":[0.12, 0.37],
+ "target":"beatVisual",
+ "property":"offset",
+ "initialValue":[0, 0],
+ "targetValue":[0.25, 0],
"animator":
{
- "alphaFunction":"EASE_IN",
+ "alphaFunction":"BOUNCE",
"timePeriod":
{
- "duration":0.4,
+ "duration":0.5,
"delay":0
}
}
}
],
- "uncheckTransition":
+
+ "upTransition":
[
{
- "target":"checkboxFgVisual",
- "property":"pixelArea",
- "initialValue":[0.0, 0.0, 1.0, 1.0],
- "targetValue":[0.0, 0.0, 0.0, 1.0],
+ "target":"beatVisual",
+ "property":"offset",
+ "initialValue":[0, 0],
+ "targetValue":[0, 0.25],
"animator":
{
- "alphaFunction":"EASE_OUT",
+ "alphaFunction":"BOUNCE",
"timePeriod":
{
- "duration":0.4,
+ "duration":0.5,
"delay":0
}
}
- },
+ }
+ ],
+
+ "fadeTransition":
+ [
{
- "target":"checkboxFgVisual",
- "property":"size",
- "targetValue":[0.0, 0.37],
+ "target":"beatVisual",
+ "property":"opacity",
+ "targetValue":0,
"animator":
{
- "alphaFunction":"EASE_OUT",
+ "alphaFunction":"BOUNCE",
"timePeriod":
{
- "duration":0.4,
+ "duration":0.8,
"delay":0
}
}
return loader.GetPixelData();
}
-/**
- * @deprecated, dont use this anymore
- */
-Dali::Image LoadImage( const char* imagePath,
- Dali::ImageDimensions size = Dali::ImageDimensions(),
- Dali::FittingMode::Type fittingMode = Dali::FittingMode::DEFAULT,
- Dali::SamplingMode::Type samplingMode = Dali::SamplingMode::DEFAULT )
-{
- return Dali::ResourceImage::New( imagePath, size, fittingMode, samplingMode );
-}
-
Dali::Texture LoadTexture( const char* imagePath,
Dali::ImageDimensions size = Dali::ImageDimensions(),
Dali::FittingMode::Type fittingMode = Dali::FittingMode::DEFAULT,
return texture;
}
-/**
- * @brief Load an bitmap resource.
- * @deprecated, dont use this anymore
- *
- * If it is required to scaled-down to no more than the stage dimensions,
- * uses image scaling mode FittingMode::SCALE_TO_FILL to resize the image at
- * load time to cover the entire stage with pixels with no borders,
- * and filter mode BOX_THEN_LINEAR to sample the image with
- * maximum quality.
- */
-
-Dali::Image LoadStageFillingImage( const char* imagePath )
-{
- Dali::Vector2 stageSize = Dali::Stage::GetCurrent().GetSize();
- return LoadImage( imagePath, Dali::ImageDimensions( stageSize.x, stageSize.y ), Dali::FittingMode::SCALE_TO_FILL, Dali::SamplingMode::BOX_THEN_LINEAR );
-}
-
Dali::Texture LoadStageFillingTexture( const char* imagePath )
{
Dali::Vector2 stageSize = Dali::Stage::GetCurrent().GetSize();