Example of transitions of each visual type. 44/115344/9
authorDavid Steele <david.steele@samsung.com>
Thu, 16 Feb 2017 15:47:44 +0000 (15:47 +0000)
committerDavid Steele <david.steele@samsung.com>
Fri, 17 Feb 2017 19:04:42 +0000 (19:04 +0000)
Change-Id: I8d15f1aec5cdca527f93283ff179dcf572e831ea

12 files changed:
com.samsung.dali-demo.xml
examples/styling/image-channel-control-impl.cpp
examples/text-label/text-label-example.cpp
examples/visual-transitions/beat-control-impl.cpp [new file with mode: 0644]
examples/visual-transitions/beat-control-impl.h [new file with mode: 0644]
examples/visual-transitions/beat-control.cpp [new file with mode: 0644]
examples/visual-transitions/beat-control.h [new file with mode: 0644]
examples/visual-transitions/transition-application.cpp [new file with mode: 0644]
examples/visual-transitions/transition-application.h [new file with mode: 0644]
examples/visual-transitions/transition-example.cpp [new file with mode: 0644]
resources/style/mobile/style-example-theme-one.json.in
resources/style/style-example-theme-one.json.in

index 4511e54..ba61290 100644 (file)
                <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">
index c805e39..631c0fa 100644 (file)
@@ -37,12 +37,13 @@ const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER(
   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
 );
 
index e3f0523..85c51eb 100644 (file)
@@ -80,17 +80,17 @@ struct HSVColorConstraint
   {
   }
 
-  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;
@@ -173,7 +173,7 @@ public:
     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();
diff --git a/examples/visual-transitions/beat-control-impl.cpp b/examples/visual-transitions/beat-control-impl.cpp
new file mode 100644 (file)
index 0000000..ef0c56d
--- /dev/null
@@ -0,0 +1,347 @@
+/*
+ * 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
diff --git a/examples/visual-transitions/beat-control-impl.h b/examples/visual-transitions/beat-control-impl.h
new file mode 100644 (file)
index 0000000..7138a8e
--- /dev/null
@@ -0,0 +1,152 @@
+#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
diff --git a/examples/visual-transitions/beat-control.cpp b/examples/visual-transitions/beat-control.cpp
new file mode 100644 (file)
index 0000000..2dc16fd
--- /dev/null
@@ -0,0 +1,92 @@
+/*
+ * 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
diff --git a/examples/visual-transitions/beat-control.h b/examples/visual-transitions/beat-control.h
new file mode 100644 (file)
index 0000000..f0e6e00
--- /dev/null
@@ -0,0 +1,124 @@
+#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
diff --git a/examples/visual-transitions/transition-application.cpp b/examples/visual-transitions/transition-application.cpp
new file mode 100644 (file)
index 0000000..32c4188
--- /dev/null
@@ -0,0 +1,342 @@
+/*
+ * 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
diff --git a/examples/visual-transitions/transition-application.h b/examples/visual-transitions/transition-application.h
new file mode 100644 (file)
index 0000000..9846c11
--- /dev/null
@@ -0,0 +1,85 @@
+#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
diff --git a/examples/visual-transitions/transition-example.cpp b/examples/visual-transitions/transition-example.cpp
new file mode 100644 (file)
index 0000000..adc4563
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * 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;
+}
index 6d6c7d8..9447a9d 100644 (file)
@@ -73,9 +73,9 @@
       [
         {
           "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",
@@ -96,8 +96,8 @@
       [
         {
           "target":"imageVisual",
-          "property":"mixColor",
-          "targetValue":[1,1,1,0],
+          "property":"opacity",
+          "targetValue":0,
           "animator":
           {
             "alphaFunction":"EASE_IN_OUT",
           }
         }
       ]
+    },
+    "BeatControl":
+    {
+      "beatVisual":{
+        "visualType":"IMAGE",
+        "url":"{APPLICATION_RESOURCE_PATH}/images/Logo-for-demo.png"
+      },
+
+      "bounceTransition":
+      [
+        {
+          "target":"beatVisual",
+          "property":"size",
+          "initialValue":[0.5, 0.5],
+          "targetValue":[0.75, 0.75],
+          "animator":
+          {
+            "alphaFunction":"BOUNCE",
+            "timePeriod":
+            {
+              "duration":0.5,
+              "delay":0
+            }
+          }
+        }
+      ],
+
+      "leftTransition":
+      [
+        {
+          "target":"beatVisual",
+          "property":"offset",
+          "initialValue":[0, 0],
+          "targetValue":[0.25, 0],
+          "animator":
+          {
+            "alphaFunction":"BOUNCE",
+            "timePeriod":
+            {
+              "duration":0.5,
+              "delay":0
+            }
+          }
+        }
+      ],
+
+      "upTransition":
+      [
+        {
+          "target":"beatVisual",
+          "property":"offset",
+          "initialValue":[0, 0],
+          "targetValue":[0, 0.25],
+          "animator":
+          {
+            "alphaFunction":"BOUNCE",
+            "timePeriod":
+            {
+              "duration":0.5,
+              "delay":0
+            }
+          }
+        }
+      ],
+
+      "fadeTransition":
+      [
+        {
+          "target":"beatVisual",
+          "property":"opacity",
+          "targetValue":0,
+          "animator":
+          {
+            "alphaFunction":"BOUNCE",
+            "timePeriod":
+            {
+              "duration":0.8,
+              "delay":0
+            }
+          }
+        }
+      ]
     }
   }
 }
index a28f842..507c685 100644 (file)
@@ -73,9 +73,9 @@
       [
         {
           "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",
@@ -96,8 +96,8 @@
       [
         {
           "target":"imageVisual",
-          "property":"mixColor",
-          "targetValue":[1,1,1,0],
+          "property":"opacity",
+          "targetValue":0,
           "animator":
           {
             "alphaFunction":"EASE_IN_OUT",
           }
         }
       ]
+    },
+    "BeatControl":
+    {
+      "beatVisual":{
+        "visualType":"IMAGE",
+        "url":"{APPLICATION_RESOURCE_PATH}/images/Logo-for-demo.png"
+      },
+
+      "bounceTransition":
+      [
+        {
+          "target":"beatVisual",
+          "property":"size",
+          "initialValue":[0.5, 0.5],
+          "targetValue":[0.75, 0.75],
+          "animator":
+          {
+            "alphaFunction":"BOUNCE",
+            "timePeriod":
+            {
+              "duration":0.5,
+              "delay":0
+            }
+          }
+        }
+      ],
+
+      "leftTransition":
+      [
+        {
+          "target":"beatVisual",
+          "property":"offset",
+          "initialValue":[0, 0],
+          "targetValue":[0.25, 0],
+          "animator":
+          {
+            "alphaFunction":"BOUNCE",
+            "timePeriod":
+            {
+              "duration":0.5,
+              "delay":0
+            }
+          }
+        }
+      ],
+
+      "upTransition":
+      [
+        {
+          "target":"beatVisual",
+          "property":"offset",
+          "initialValue":[0, 0],
+          "targetValue":[0, 0.25],
+          "animator":
+          {
+            "alphaFunction":"BOUNCE",
+            "timePeriod":
+            {
+              "duration":0.5,
+              "delay":0
+            }
+          }
+        }
+      ],
+
+      "fadeTransition":
+      [
+        {
+          "target":"beatVisual",
+          "property":"opacity",
+          "targetValue":0,
+          "animator":
+          {
+            "alphaFunction":"BOUNCE",
+            "timePeriod":
+            {
+              "duration":0.8,
+              "delay":0
+            }
+          }
+        }
+      ]
     }
   }
 }