Commit 4ac781f59637464b9c708e0f442b33892a9d22f8
1 parent
23b59c2e
Custom control transform animation
Added a new demo (transitions.example) that shows off animating transform properties on a visual. Change-Id: Ic333241f6618dcaf274d0e2ac399e0e5f3ed2a61
Showing
15 changed files
with
1067 additions
and
3 deletions
com.samsung.dali-demo.xml
| ... | ... | @@ -175,4 +175,7 @@ |
| 175 | 175 | <ui-application appid="fpp-game.example" exec="/usr/apps/com.samsung.dali-demo/bin/fpp-game.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> |
| 176 | 176 | <label>First Person Camera Game</label> |
| 177 | 177 | </ui-application> |
| 178 | + <ui-application appid="transitions.example" exec="/usr/apps/com.samsung.dali-demo/bin/transitions.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> | |
| 179 | + <label>Visual Transitions</label> | |
| 180 | + </ui-application> | |
| 178 | 181 | </manifest> | ... | ... |
demo/dali-demo.cpp
| ... | ... | @@ -82,6 +82,7 @@ int DALI_EXPORT_API main(int argc, char **argv) |
| 82 | 82 | demo.AddExample(Example("primitive-shapes.example", DALI_DEMO_STR_TITLE_PRIMITIVE_SHAPES)); |
| 83 | 83 | demo.AddExample(Example("styling.example", DALI_DEMO_STR_TITLE_STYLING)); |
| 84 | 84 | demo.AddExample(Example("sparkle.example", DALI_DEMO_STR_TITLE_SPARKLE)); |
| 85 | + demo.AddExample(Example("transitions.example", DALI_DEMO_STR_TITLE_VISUAL_TRANSITIONS)); | |
| 85 | 86 | demo.AddExample(Example("progress-bar.example", DALI_DEMO_STR_TITLE_PROGRESS_BAR)); |
| 86 | 87 | demo.AddExample(Example("contact-cards.example", DALI_DEMO_STR_TITLE_CONTACT_CARDS)); |
| 87 | 88 | demo.AddExample(Example("flex-container.example", DALI_DEMO_STR_TITLE_FLEXBOX_PLAYGROUND)); | ... | ... |
examples/styling/image-channel-control-impl.cpp
| ... | ... | @@ -112,8 +112,6 @@ void ImageChannelControl::SetVisibility( bool visibility ) |
| 112 | 112 | { |
| 113 | 113 | printf("ImageChannelControl %s: SetVisibility( %s )\n", Self().GetName().c_str(), visibility?"T":"F" ); |
| 114 | 114 | |
| 115 | - Animation animation; | |
| 116 | - | |
| 117 | 115 | if( mAnimation ) |
| 118 | 116 | { |
| 119 | 117 | mAnimation.Stop(); | ... | ... |
examples/transitions/beat-control-impl.cpp
0 → 100644
| 1 | +/* | |
| 2 | + * Copyright (c) 2016 Samsung Electronics Co., Ltd. | |
| 3 | + * | |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | |
| 5 | + * you may not use this file except in compliance with the License. | |
| 6 | + * You may obtain a copy of the License at | |
| 7 | + * | |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | |
| 9 | + * | |
| 10 | + * Unless required by applicable law or agreed to in writing, software | |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 13 | + * See the License for the specific language governing permissions and | |
| 14 | + * limitations under the License. | |
| 15 | + */ | |
| 16 | + | |
| 17 | +#include "beat-control-impl.h" | |
| 18 | +#include <dali-toolkit/dali-toolkit.h> | |
| 19 | +#include <dali/public-api/object/type-registry-helper.h> | |
| 20 | +#include <dali-toolkit/devel-api/align-enums.h> | |
| 21 | +#include <dali-toolkit/devel-api/visual-factory/visual-factory.h> | |
| 22 | +#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h> | |
| 23 | + | |
| 24 | +#include <cstdio> | |
| 25 | + | |
| 26 | +using namespace Dali; // Needed for macros | |
| 27 | +using namespace Dali::Toolkit; | |
| 28 | + | |
| 29 | +namespace Demo | |
| 30 | +{ | |
| 31 | +namespace Internal | |
| 32 | +{ | |
| 33 | + | |
| 34 | +namespace | |
| 35 | +{ | |
| 36 | + | |
| 37 | + | |
| 38 | +Dali::BaseHandle Create() | |
| 39 | +{ | |
| 40 | + return Demo::BeatControl::New(); | |
| 41 | +} | |
| 42 | + | |
| 43 | +DALI_TYPE_REGISTRATION_BEGIN( BeatControl, Dali::Toolkit::Control, Create ); | |
| 44 | + | |
| 45 | +DALI_PROPERTY_REGISTRATION( Demo, BeatControl, "bounceTransition", STRING, BOUNCE_TRANSITION ); | |
| 46 | +DALI_PROPERTY_REGISTRATION( Demo, BeatControl, "leftTransition", STRING, LEFT_TRANSITION ); | |
| 47 | +DALI_PROPERTY_REGISTRATION( Demo, BeatControl, "upTransition", STRING, UP_TRANSITION ); | |
| 48 | +DALI_PROPERTY_REGISTRATION( Demo, BeatControl, "beatVisual", MAP, BEAT_VISUAL ); | |
| 49 | +DALI_TYPE_REGISTRATION_END(); | |
| 50 | + | |
| 51 | + | |
| 52 | +Toolkit::TransitionData ConvertPropertyToTransition( const Property::Value& value ) | |
| 53 | +{ | |
| 54 | + Toolkit::TransitionData transitionData; | |
| 55 | + | |
| 56 | + if( value.GetType() == Property::ARRAY ) | |
| 57 | + { | |
| 58 | + transitionData = Toolkit::TransitionData::New( *value.GetArray()); | |
| 59 | + } | |
| 60 | + else if( value.GetType() == Property::MAP ) | |
| 61 | + { | |
| 62 | + transitionData = Toolkit::TransitionData::New( *value.GetMap() ); | |
| 63 | + } | |
| 64 | + return transitionData; | |
| 65 | +} | |
| 66 | + | |
| 67 | +} // anonymous namespace | |
| 68 | + | |
| 69 | + | |
| 70 | +Internal::BeatControl::BeatControl() | |
| 71 | +: Control( ControlBehaviour( REQUIRES_STYLE_CHANGE_SIGNALS ) ) | |
| 72 | +{ | |
| 73 | +} | |
| 74 | + | |
| 75 | +Internal::BeatControl::~BeatControl() | |
| 76 | +{ | |
| 77 | +} | |
| 78 | + | |
| 79 | +Demo::BeatControl Internal::BeatControl::New() | |
| 80 | +{ | |
| 81 | + IntrusivePtr<Internal::BeatControl> impl = new Internal::BeatControl(); | |
| 82 | + Demo::BeatControl handle = Demo::BeatControl( *impl ); | |
| 83 | + impl->Initialize(); | |
| 84 | + return handle; | |
| 85 | +} | |
| 86 | + | |
| 87 | + | |
| 88 | +void BeatControl::StartBounceAnimation() | |
| 89 | +{ | |
| 90 | + if( mAnimation ) | |
| 91 | + { | |
| 92 | + mAnimation.Stop(); | |
| 93 | + mAnimation.FinishedSignal().Disconnect( this, &BeatControl::OnBounceAnimationFinished ); | |
| 94 | + OnBounceAnimationFinished(mAnimation); | |
| 95 | + } | |
| 96 | + | |
| 97 | + mAnimation = CreateTransition( mBounceTransition ); | |
| 98 | + mAnimation.FinishedSignal().Connect( this, &BeatControl::OnBounceAnimationFinished ); | |
| 99 | + mAnimation.Play(); | |
| 100 | +} | |
| 101 | + | |
| 102 | + | |
| 103 | +void BeatControl::StartXAnimation() | |
| 104 | +{ | |
| 105 | + if( mXAnimation ) | |
| 106 | + { | |
| 107 | + mXAnimation.Stop(); | |
| 108 | + mXAnimation.FinishedSignal().Disconnect( this, &BeatControl::OnXAnimationFinished ); | |
| 109 | + OnXAnimationFinished(mXAnimation); | |
| 110 | + } | |
| 111 | + | |
| 112 | + mXAnimation = CreateTransition( mLeftTransition ); | |
| 113 | + mXAnimation.FinishedSignal().Connect( this, &BeatControl::OnXAnimationFinished ); | |
| 114 | + mXAnimation.Play(); | |
| 115 | +} | |
| 116 | + | |
| 117 | +void BeatControl::StartYAnimation() | |
| 118 | +{ | |
| 119 | + if( mYAnimation ) | |
| 120 | + { | |
| 121 | + mYAnimation.Stop(); | |
| 122 | + mYAnimation.FinishedSignal().Disconnect( this, &BeatControl::OnYAnimationFinished ); | |
| 123 | + OnYAnimationFinished(mYAnimation); | |
| 124 | + } | |
| 125 | + | |
| 126 | + mYAnimation = CreateTransition( mUpTransition ); | |
| 127 | + mYAnimation.FinishedSignal().Connect( this, &BeatControl::OnYAnimationFinished ); | |
| 128 | + mYAnimation.Play(); | |
| 129 | +} | |
| 130 | + | |
| 131 | + | |
| 132 | +void BeatControl::OnBounceAnimationFinished( Animation& src ) | |
| 133 | +{ | |
| 134 | + // Do stuff | |
| 135 | +} | |
| 136 | +void BeatControl::OnXAnimationFinished( Animation& src ) | |
| 137 | +{ | |
| 138 | + // Do stuff | |
| 139 | +} | |
| 140 | +void BeatControl::OnYAnimationFinished( Animation& src ) | |
| 141 | +{ | |
| 142 | + // Do stuff | |
| 143 | +} | |
| 144 | + | |
| 145 | +void BeatControl::OnInitialize() | |
| 146 | +{ | |
| 147 | + Actor self = Self(); | |
| 148 | +} | |
| 149 | + | |
| 150 | +void BeatControl::OnStageConnection( int depth ) | |
| 151 | +{ | |
| 152 | + Control::OnStageConnection( depth ); | |
| 153 | +} | |
| 154 | + | |
| 155 | +void BeatControl::OnStageDisconnection() | |
| 156 | +{ | |
| 157 | + Control::OnStageDisconnection(); | |
| 158 | +} | |
| 159 | + | |
| 160 | +void BeatControl::OnSizeSet( const Vector3& targetSize ) | |
| 161 | +{ | |
| 162 | + Control::OnSizeSet( targetSize ); | |
| 163 | + RelayoutVisuals( Vector2( targetSize ) ); | |
| 164 | +} | |
| 165 | + | |
| 166 | +void BeatControl::OnRelayout( const Vector2& targetSize, RelayoutContainer& container ) | |
| 167 | +{ | |
| 168 | + RelayoutVisuals( targetSize ); | |
| 169 | +} | |
| 170 | + | |
| 171 | +void BeatControl::RelayoutVisuals( const Vector2& targetSize ) | |
| 172 | +{ | |
| 173 | + if( mVisual ) | |
| 174 | + { | |
| 175 | + Vector2 size( targetSize ); | |
| 176 | + Property::Map transformMap; | |
| 177 | + // Make the visual half the size of the control, but leave | |
| 178 | + // origin and anchor point at center, position is relative, but Zer0 | |
| 179 | + transformMap[ DevelVisual::Transform::Property::SIZE ] = Vector2(0.5, 0.5); | |
| 180 | + mVisual.SetTransformAndSize( transformMap, size ); | |
| 181 | + | |
| 182 | + // @todo We must stop this clashing with a transform animation | |
| 183 | + } | |
| 184 | +} | |
| 185 | + | |
| 186 | +Vector3 BeatControl::GetNaturalSize() | |
| 187 | +{ | |
| 188 | + if( mVisual ) | |
| 189 | + { | |
| 190 | + Vector2 naturalSize; | |
| 191 | + mVisual.GetNaturalSize(naturalSize); | |
| 192 | + return Vector3(naturalSize); | |
| 193 | + } | |
| 194 | + return Vector3::ZERO; | |
| 195 | +} | |
| 196 | + | |
| 197 | +void BeatControl::OnStyleChange( Toolkit::StyleManager styleManager, StyleChange::Type change ) | |
| 198 | +{ | |
| 199 | + // Chain up. | |
| 200 | + Control::OnStyleChange( styleManager, change ); | |
| 201 | +} | |
| 202 | + | |
| 203 | + | |
| 204 | +/////////////////////////////////////////////////////////// | |
| 205 | +// | |
| 206 | +// Properties | |
| 207 | +// | |
| 208 | + | |
| 209 | +void BeatControl::SetProperty( BaseObject* object, Property::Index index, const Property::Value& value ) | |
| 210 | +{ | |
| 211 | + Demo::BeatControl beatControl = Demo::BeatControl::DownCast( Dali::BaseHandle( object ) ); | |
| 212 | + | |
| 213 | + if( beatControl ) | |
| 214 | + { | |
| 215 | + BeatControl& impl = GetImpl( beatControl ); | |
| 216 | + Actor self = impl.Self(); | |
| 217 | + switch ( index ) | |
| 218 | + { | |
| 219 | + case Demo::BeatControl::Property::BEAT_VISUAL: | |
| 220 | + { | |
| 221 | + Property::Map* map = value.GetMap(); | |
| 222 | + if( map ) | |
| 223 | + { | |
| 224 | + impl.mVisual = Toolkit::VisualFactory::Get().CreateVisual( *map ); | |
| 225 | + impl.RegisterVisual( Demo::BeatControl::Property::BEAT_VISUAL, impl.mVisual ); | |
| 226 | + } | |
| 227 | + break; | |
| 228 | + } | |
| 229 | + case Demo::BeatControl::Property::BOUNCE_TRANSITION: | |
| 230 | + { | |
| 231 | + impl.mBounceTransition = ConvertPropertyToTransition( value ); | |
| 232 | + break; | |
| 233 | + } | |
| 234 | + case Demo::BeatControl::Property::LEFT_TRANSITION: | |
| 235 | + { | |
| 236 | + impl.mLeftTransition = ConvertPropertyToTransition( value ); | |
| 237 | + break; | |
| 238 | + } | |
| 239 | + case Demo::BeatControl::Property::UP_TRANSITION: | |
| 240 | + { | |
| 241 | + impl.mUpTransition = ConvertPropertyToTransition( value ); | |
| 242 | + break; | |
| 243 | + } | |
| 244 | + } | |
| 245 | + } | |
| 246 | +} | |
| 247 | + | |
| 248 | +Property::Value BeatControl::GetProperty( BaseObject* object, Property::Index propertyIndex ) | |
| 249 | +{ | |
| 250 | + Property::Value value; | |
| 251 | + | |
| 252 | + Demo::BeatControl beatControl = Demo::BeatControl::DownCast( Dali::BaseHandle( object ) ); | |
| 253 | + | |
| 254 | + if ( beatControl ) | |
| 255 | + { | |
| 256 | + BeatControl& impl = GetImpl( beatControl ); | |
| 257 | + switch ( propertyIndex ) | |
| 258 | + { | |
| 259 | + case Demo::BeatControl::Property::BEAT_VISUAL: | |
| 260 | + { | |
| 261 | + if( impl.mVisual ) | |
| 262 | + { | |
| 263 | + Property::Map map; | |
| 264 | + impl.mVisual.CreatePropertyMap(map); | |
| 265 | + value = map; | |
| 266 | + } | |
| 267 | + break; | |
| 268 | + } | |
| 269 | + case Demo::BeatControl::Property::BOUNCE_TRANSITION: | |
| 270 | + default: | |
| 271 | + break; | |
| 272 | + } | |
| 273 | + } | |
| 274 | + | |
| 275 | + return value; | |
| 276 | +} | |
| 277 | + | |
| 278 | + | |
| 279 | +} // Internal | |
| 280 | +} // Demo | ... | ... |
examples/transitions/beat-control-impl.h
0 → 100644
| 1 | +#ifndef DALI_DEMO_INTERNAL_BEAT_CONTROL_IMPL_H | |
| 2 | +#define DALI_DEMO_INTERNAL_BEAT_CONTROL_IMPL_H | |
| 3 | + | |
| 4 | +/* | |
| 5 | + * Copyright (c) 2016 Samsung Electronics Co., Ltd. | |
| 6 | + * | |
| 7 | + * Licensed under the Apache License, Version 2.0 (the "License"); | |
| 8 | + * you may not use this file except in compliance with the License. | |
| 9 | + * You may obtain a copy of the License at | |
| 10 | + * | |
| 11 | + * http://www.apache.org/licenses/LICENSE-2.0 | |
| 12 | + * | |
| 13 | + * Unless required by applicable law or agreed to in writing, software | |
| 14 | + * distributed under the License is distributed on an "AS IS" BASIS, | |
| 15 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 16 | + * See the License for the specific language governing permissions and | |
| 17 | + * limitations under the License. | |
| 18 | + */ | |
| 19 | + | |
| 20 | +#include "beat-control.h" | |
| 21 | +#include <dali/public-api/animation/animation.h> | |
| 22 | +#include <dali-toolkit/public-api/controls/control-impl.h> | |
| 23 | +#include <dali-toolkit/devel-api/visual-factory/visual-base.h> | |
| 24 | +#include <dali-toolkit/devel-api/visual-factory/transition-data.h> | |
| 25 | + | |
| 26 | +namespace Demo | |
| 27 | +{ | |
| 28 | + | |
| 29 | +namespace Internal // To use TypeRegistry, handle and body classes need the same name | |
| 30 | +{ | |
| 31 | + | |
| 32 | +class BeatControl : public Dali::Toolkit::Internal::Control | |
| 33 | +{ | |
| 34 | +public: | |
| 35 | + /** | |
| 36 | + * Instantiate a new BeatControl object | |
| 37 | + */ | |
| 38 | + static Demo::BeatControl New(); | |
| 39 | + BeatControl(); | |
| 40 | + ~BeatControl(); | |
| 41 | + | |
| 42 | +public: // API | |
| 43 | + void StartBounceAnimation(); | |
| 44 | + | |
| 45 | + void StartXAnimation(); | |
| 46 | + | |
| 47 | + void StartYAnimation(); | |
| 48 | + | |
| 49 | +public: // Properties | |
| 50 | + /** | |
| 51 | + * Called when a property of an object of this type is set. | |
| 52 | + * @param[in] object The object whose property is set. | |
| 53 | + * @param[in] index The property index. | |
| 54 | + * @param[in] value The new property value. | |
| 55 | + */ | |
| 56 | + static void SetProperty( Dali::BaseObject* object, Dali::Property::Index index, const Dali::Property::Value& value ); | |
| 57 | + | |
| 58 | + /** | |
| 59 | + * Called to retrieve a property of an object of this type. | |
| 60 | + * @param[in] object The object whose property is to be retrieved. | |
| 61 | + * @param[in] index The property index. | |
| 62 | + * @return The current value of the property. | |
| 63 | + */ | |
| 64 | + static Dali::Property::Value GetProperty( Dali::BaseObject* object, Dali::Property::Index propertyIndex ); | |
| 65 | + | |
| 66 | +private: // From Control | |
| 67 | + /** | |
| 68 | + * @copydoc Toolkit::Control::OnInitialize() | |
| 69 | + */ | |
| 70 | + virtual void OnInitialize(); | |
| 71 | + | |
| 72 | + /** | |
| 73 | + * @copydoc Toolkit::Control::OnStageConnect() | |
| 74 | + */ | |
| 75 | + virtual void OnStageConnection( int depth ); | |
| 76 | + | |
| 77 | + /** | |
| 78 | + * @copydoc Toolkit::Control::OnStageDisconnection() | |
| 79 | + */ | |
| 80 | + virtual void OnStageDisconnection(); | |
| 81 | + | |
| 82 | + /** | |
| 83 | + * @copydoc Toolkit::Control::OnSizeSet() | |
| 84 | + */ | |
| 85 | + virtual void OnSizeSet( const Dali::Vector3& targetSize ); | |
| 86 | + | |
| 87 | + /** | |
| 88 | + * @copydoc Toolkit::Control::OnRelayout() | |
| 89 | + */ | |
| 90 | + virtual void OnRelayout( const Dali::Vector2& targetSize, Dali::RelayoutContainer& container ); | |
| 91 | + /** | |
| 92 | + * @copydoc Toolkit::Control::GetNaturalSize | |
| 93 | + */ | |
| 94 | + virtual Dali::Vector3 GetNaturalSize(); | |
| 95 | + | |
| 96 | + /** | |
| 97 | + * @copydoc Toolkit::Control::OnStyleChange | |
| 98 | + */ | |
| 99 | + virtual void OnStyleChange( Dali::Toolkit::StyleManager styleManager, Dali::StyleChange::Type change ); | |
| 100 | + | |
| 101 | +private: | |
| 102 | + void OnBounceAnimationFinished( Dali::Animation& handle ); | |
| 103 | + void OnXAnimationFinished( Dali::Animation& src ); | |
| 104 | + void OnYAnimationFinished( Dali::Animation& src ); | |
| 105 | + | |
| 106 | + /** | |
| 107 | + * Relayout the visuals as a result of size negotiation | |
| 108 | + */ | |
| 109 | + void RelayoutVisuals( const Dali::Vector2& targetSize ); | |
| 110 | + | |
| 111 | +private: | |
| 112 | + //undefined | |
| 113 | + BeatControl( const BeatControl& ); | |
| 114 | + BeatControl& operator=( const BeatControl& ); | |
| 115 | + | |
| 116 | +private: | |
| 117 | + // Implementation details | |
| 118 | + Dali::Toolkit::Visual::Base mVisual; | |
| 119 | + Dali::Toolkit::TransitionData mBounceTransition; | |
| 120 | + Dali::Toolkit::TransitionData mLeftTransition; | |
| 121 | + Dali::Toolkit::TransitionData mUpTransition; | |
| 122 | + Dali::Animation mAnimation; | |
| 123 | + Dali::Animation mXAnimation; | |
| 124 | + Dali::Animation mYAnimation; | |
| 125 | +}; | |
| 126 | + | |
| 127 | +} // Internal | |
| 128 | + | |
| 129 | +inline Internal::BeatControl& GetImpl( Demo::BeatControl& handle ) | |
| 130 | +{ | |
| 131 | + DALI_ASSERT_ALWAYS( handle ); | |
| 132 | + Dali::RefObject& object = handle.GetImplementation(); | |
| 133 | + return static_cast<Internal::BeatControl&>(object); | |
| 134 | +} | |
| 135 | + | |
| 136 | +inline const Internal::BeatControl& GetImpl( const Demo::BeatControl& handle ) | |
| 137 | +{ | |
| 138 | + DALI_ASSERT_ALWAYS( handle ); | |
| 139 | + const Dali::RefObject& object = handle.GetImplementation(); | |
| 140 | + return static_cast<const Internal::BeatControl&>(object); | |
| 141 | +} | |
| 142 | + | |
| 143 | +} // Demo | |
| 144 | + | |
| 145 | +#endif // DALI_DEMO_BEAT_CONTROL_IMPL_H | ... | ... |
examples/transitions/beat-control.cpp
0 → 100644
| 1 | +/* | |
| 2 | + * Copyright (c) 2016 Samsung Electronics Co., Ltd. | |
| 3 | + * | |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | |
| 5 | + * you may not use this file except in compliance with the License. | |
| 6 | + * You may obtain a copy of the License at | |
| 7 | + * | |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | |
| 9 | + * | |
| 10 | + * Unless required by applicable law or agreed to in writing, software | |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 13 | + * See the License for the specific language governing permissions and | |
| 14 | + * limitations under the License. | |
| 15 | + */ | |
| 16 | + | |
| 17 | +#include "beat-control.h" | |
| 18 | +#include "beat-control-impl.h" | |
| 19 | + | |
| 20 | +namespace Demo | |
| 21 | +{ | |
| 22 | + | |
| 23 | +BeatControl::BeatControl() | |
| 24 | +{ | |
| 25 | +} | |
| 26 | + | |
| 27 | +BeatControl::BeatControl( const BeatControl& beatControl ) | |
| 28 | +: Control( beatControl ) | |
| 29 | +{ | |
| 30 | +} | |
| 31 | + | |
| 32 | +BeatControl& BeatControl::operator= ( const BeatControl& rhs ) | |
| 33 | +{ | |
| 34 | + if( &rhs != this ) | |
| 35 | + { | |
| 36 | + Control::operator=( rhs ); | |
| 37 | + } | |
| 38 | + return *this; | |
| 39 | +} | |
| 40 | + | |
| 41 | +BeatControl::~BeatControl() | |
| 42 | +{ | |
| 43 | +} | |
| 44 | + | |
| 45 | +BeatControl BeatControl::New() | |
| 46 | +{ | |
| 47 | + BeatControl beatControl = Internal::BeatControl::New(); | |
| 48 | + return beatControl; | |
| 49 | +} | |
| 50 | + | |
| 51 | +BeatControl BeatControl::New( const std::string& url ) | |
| 52 | +{ | |
| 53 | + BeatControl beatControl = Internal::BeatControl::New(); | |
| 54 | + return beatControl; | |
| 55 | +} | |
| 56 | + | |
| 57 | +BeatControl BeatControl::DownCast( BaseHandle handle ) | |
| 58 | +{ | |
| 59 | + return Control::DownCast< BeatControl, Internal::BeatControl > ( handle ); | |
| 60 | +} | |
| 61 | + | |
| 62 | +void BeatControl::StartBounceAnimation() | |
| 63 | +{ | |
| 64 | + GetImpl(*this).StartBounceAnimation(); | |
| 65 | +} | |
| 66 | + | |
| 67 | +void BeatControl::StartXAnimation() | |
| 68 | +{ | |
| 69 | + GetImpl(*this).StartXAnimation(); | |
| 70 | +} | |
| 71 | +void BeatControl::StartYAnimation() | |
| 72 | +{ | |
| 73 | + GetImpl(*this).StartYAnimation(); | |
| 74 | +} | |
| 75 | + | |
| 76 | + | |
| 77 | +BeatControl::BeatControl( Internal::BeatControl& implementation ) | |
| 78 | +: Control( implementation ) | |
| 79 | +{ | |
| 80 | +} | |
| 81 | + | |
| 82 | +BeatControl::BeatControl( Dali::Internal::CustomActor* internal ) | |
| 83 | +: Control( internal ) | |
| 84 | +{ | |
| 85 | + VerifyCustomActorPointer< Internal::BeatControl >( internal ) ; | |
| 86 | +} | |
| 87 | + | |
| 88 | + | |
| 89 | +} //namespace Demo | ... | ... |
examples/transitions/beat-control.h
0 → 100644
| 1 | +#ifndef DALI_DEMO_BEAT_CONTROL_H | |
| 2 | +#define DALI_DEMO_BEAT_CONTROL_H | |
| 3 | + | |
| 4 | +/* | |
| 5 | + * Copyright (c) 2016 Samsung Electronics Co., Ltd. | |
| 6 | + * | |
| 7 | + * Licensed under the Apache License, Version 2.0 (the "License"); | |
| 8 | + * you may not use this file except in compliance with the License. | |
| 9 | + * You may obtain a copy of the License at | |
| 10 | + * | |
| 11 | + * http://www.apache.org/licenses/LICENSE-2.0 | |
| 12 | + * | |
| 13 | + * Unless required by applicable law or agreed to in writing, software | |
| 14 | + * distributed under the License is distributed on an "AS IS" BASIS, | |
| 15 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 16 | + * See the License for the specific language governing permissions and | |
| 17 | + * limitations under the License. | |
| 18 | + */ | |
| 19 | + | |
| 20 | +#include <dali-toolkit/dali-toolkit.h> | |
| 21 | +#include <string> | |
| 22 | + | |
| 23 | +namespace Demo | |
| 24 | +{ | |
| 25 | + | |
| 26 | +namespace Internal | |
| 27 | +{ | |
| 28 | +// All type registered types need to have the same name for the body and the handle | |
| 29 | +class BeatControl; | |
| 30 | +} | |
| 31 | + | |
| 32 | +/** | |
| 33 | + * Control that allows the RGB channels of an image to be altered. | |
| 34 | + */ | |
| 35 | +class BeatControl : public Dali::Toolkit::Control | |
| 36 | +{ | |
| 37 | +public: | |
| 38 | + /** | |
| 39 | + * The start and end property ranges for this control | |
| 40 | + */ | |
| 41 | + enum PropertyRange | |
| 42 | + { | |
| 43 | + PROPERTY_START_INDEX = Dali::Toolkit::Control::CONTROL_PROPERTY_END_INDEX + 1, | |
| 44 | + PROPERTY_END_INDEX = PROPERTY_START_INDEX + 1000, | |
| 45 | + ANIMATABLE_PROPERTY_START_INDEX = Dali::ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX, | |
| 46 | + ANIMATABLE_PROPERTY_END_INDEX = ANIMATABLE_PROPERTY_START_INDEX+1000 | |
| 47 | + }; | |
| 48 | + | |
| 49 | + struct Property | |
| 50 | + { | |
| 51 | + enum | |
| 52 | + { | |
| 53 | + BOUNCE_TRANSITION = PROPERTY_START_INDEX, | |
| 54 | + LEFT_TRANSITION, | |
| 55 | + UP_TRANSITION, | |
| 56 | + BEAT_VISUAL | |
| 57 | + }; | |
| 58 | + }; | |
| 59 | + | |
| 60 | +public: // Construction / destruction | |
| 61 | + | |
| 62 | + /** | |
| 63 | + * Create an uninitialized handle | |
| 64 | + */ | |
| 65 | + BeatControl(); | |
| 66 | + | |
| 67 | + /** | |
| 68 | + * Create a new image channel control without an image. Use | |
| 69 | + * SetImage to give this control an image | |
| 70 | + */ | |
| 71 | + static BeatControl New(); | |
| 72 | + | |
| 73 | + /** | |
| 74 | + * Create a new image channel control from a given URL | |
| 75 | + */ | |
| 76 | + static BeatControl New( const std::string& url ); | |
| 77 | + | |
| 78 | + /** | |
| 79 | + * Destructor. This is non-virtual since derived Handle types must not | |
| 80 | + * contain data or virtual methods | |
| 81 | + */ | |
| 82 | + ~BeatControl(); | |
| 83 | + | |
| 84 | + /** | |
| 85 | + * Copy Constructor | |
| 86 | + */ | |
| 87 | + BeatControl( const BeatControl& beatControl ); | |
| 88 | + | |
| 89 | + /** | |
| 90 | + * Assignment Operator | |
| 91 | + */ | |
| 92 | + BeatControl& operator=( const BeatControl& beatControl ); | |
| 93 | + | |
| 94 | + /** | |
| 95 | + * Downcast | |
| 96 | + */ | |
| 97 | + static BeatControl DownCast( BaseHandle handle ); | |
| 98 | + | |
| 99 | +public: // API | |
| 100 | + | |
| 101 | + void StartBounceAnimation(); | |
| 102 | + | |
| 103 | + void StartXAnimation(); | |
| 104 | + | |
| 105 | + void StartYAnimation(); | |
| 106 | + | |
| 107 | +public: // Not for public use | |
| 108 | + /** | |
| 109 | + * Create a handle from an implementation | |
| 110 | + */ | |
| 111 | + BeatControl( Internal::BeatControl& implementation ); | |
| 112 | + | |
| 113 | + /** | |
| 114 | + * Allow the creation of an BeatControl handle from an internal CustomActor pointer | |
| 115 | + */ | |
| 116 | + BeatControl( Dali::Internal::CustomActor* internal ); | |
| 117 | +}; | |
| 118 | + | |
| 119 | +} // namespace Demo | |
| 120 | + | |
| 121 | +#endif // DALI_DEMO_BEAT_CONTROL_H | ... | ... |
examples/transitions/transition-application.cpp
0 → 100644
| 1 | +/* | |
| 2 | + * Copyright (c) 2016 Samsung Electronics Co., Ltd. | |
| 3 | + * | |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | |
| 5 | + * you may not use this file except in compliance with the License. | |
| 6 | + * You may obtain a copy of the License at | |
| 7 | + * | |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | |
| 9 | + * | |
| 10 | + * Unless required by applicable law or agreed to in writing, software | |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 13 | + * See the License for the specific language governing permissions and | |
| 14 | + * limitations under the License. | |
| 15 | + */ | |
| 16 | + | |
| 17 | +/** | |
| 18 | + * @file transition-application.cpp | |
| 19 | + * @brief Application class for showing stylable transitions | |
| 20 | + */ | |
| 21 | + | |
| 22 | +// Class include | |
| 23 | +#include "transition-application.h" | |
| 24 | + | |
| 25 | +// External includes | |
| 26 | +#include <dali-toolkit/dali-toolkit.h> | |
| 27 | +#include "beat-control.h" | |
| 28 | +#include <cstdio> | |
| 29 | +#include <sstream> | |
| 30 | + | |
| 31 | +// Internal includes | |
| 32 | + | |
| 33 | +using namespace Dali; | |
| 34 | +using namespace Dali::Toolkit; | |
| 35 | + | |
| 36 | +namespace Demo | |
| 37 | +{ | |
| 38 | + | |
| 39 | +const char* TransitionApplication::DEMO_THEME_ONE_PATH( DEMO_STYLE_DIR "style-example-theme-one.json" ); | |
| 40 | + | |
| 41 | + | |
| 42 | +TransitionApplication::TransitionApplication( Application& application ) | |
| 43 | +: mApplication( application ) | |
| 44 | +{ | |
| 45 | + application.InitSignal().Connect( this, &TransitionApplication::Create ); | |
| 46 | +} | |
| 47 | + | |
| 48 | +TransitionApplication::~TransitionApplication() | |
| 49 | +{ | |
| 50 | +} | |
| 51 | + | |
| 52 | +void TransitionApplication::Create( Application& application ) | |
| 53 | +{ | |
| 54 | + Stage stage = Stage::GetCurrent(); | |
| 55 | + stage.KeyEventSignal().Connect(this, &TransitionApplication::OnKeyEvent); | |
| 56 | + stage.SetBackgroundColor( Vector4( 0.1f, 0.1f, 0.1f, 1.0f ) ); | |
| 57 | + | |
| 58 | + // Hide the indicator bar | |
| 59 | + application.GetWindow().ShowIndicator( Dali::Window::INVISIBLE ); | |
| 60 | + | |
| 61 | + // Content panes: | |
| 62 | + TableView contentLayout = TableView::New( 3, 1 ); | |
| 63 | + contentLayout.SetName("ContentLayout"); | |
| 64 | + contentLayout.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); | |
| 65 | + contentLayout.SetAnchorPoint( AnchorPoint::TOP_LEFT ); | |
| 66 | + contentLayout.SetParentOrigin( ParentOrigin::TOP_LEFT ); | |
| 67 | + contentLayout.SetCellPadding( Size( 10, 10 ) ); | |
| 68 | + | |
| 69 | + // Assign all rows the size negotiation property of fitting to children | |
| 70 | + | |
| 71 | + stage.Add( contentLayout ); | |
| 72 | + | |
| 73 | + mTitle = TextLabel::New( "Custom Control Transition Example" ); | |
| 74 | + mTitle.SetName( "Title" ); | |
| 75 | + mTitle.SetStyleName("Title"); | |
| 76 | + mTitle.SetAnchorPoint( AnchorPoint::TOP_CENTER ); | |
| 77 | + mTitle.SetParentOrigin( ParentOrigin::TOP_CENTER ); | |
| 78 | + mTitle.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); | |
| 79 | + mTitle.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); | |
| 80 | + mTitle.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); | |
| 81 | + contentLayout.Add( mTitle ); | |
| 82 | + contentLayout.SetFitHeight(0); | |
| 83 | + | |
| 84 | + mBeatControl = BeatControl::New(); | |
| 85 | + mBeatControl.SetName("BeatControl"); | |
| 86 | + mBeatControl.SetAnchorPoint( AnchorPoint::CENTER ); | |
| 87 | + mBeatControl.SetParentOrigin( ParentOrigin::CENTER ); | |
| 88 | + mBeatControl.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); | |
| 89 | + contentLayout.Add( mBeatControl ); | |
| 90 | + // beat control should fill the tableview cell, so no change to default parameters | |
| 91 | + | |
| 92 | + TableView actionButtonLayout = TableView::New( 1, 4 ); | |
| 93 | + actionButtonLayout.SetName("ThemeButtonsLayout"); | |
| 94 | + actionButtonLayout.SetCellPadding( Vector2( 6.0f, 0.0f ) ); | |
| 95 | + | |
| 96 | + actionButtonLayout.SetAnchorPoint( AnchorPoint::CENTER ); | |
| 97 | + actionButtonLayout.SetParentOrigin( ParentOrigin::CENTER ); | |
| 98 | + actionButtonLayout.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); | |
| 99 | + actionButtonLayout.SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::HEIGHT ); | |
| 100 | + actionButtonLayout.SetCellPadding( Size( 10, 10 ) ); | |
| 101 | + actionButtonLayout.SetFitHeight( 0 ); | |
| 102 | + | |
| 103 | + TextLabel label = TextLabel::New( "Action: "); | |
| 104 | + label.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); | |
| 105 | + label.SetStyleName("ActionLabel"); | |
| 106 | + label.SetAnchorPoint( AnchorPoint::TOP_CENTER ); | |
| 107 | + label.SetParentOrigin( ParentOrigin::TOP_CENTER ); | |
| 108 | + actionButtonLayout.AddChild( label, TableView::CellPosition( 0, 0 ) ); | |
| 109 | + actionButtonLayout.SetCellAlignment( TableView::CellPosition( 0, 0 ), HorizontalAlignment::LEFT, VerticalAlignment::CENTER ); | |
| 110 | + | |
| 111 | + for( int i=0; i<3; ++i ) | |
| 112 | + { | |
| 113 | + mActionButtons[i] = PushButton::New(); | |
| 114 | + mActionButtons[i].SetName("ActionButton"); | |
| 115 | + mActionButtons[i].SetStyleName("ActionButton"); | |
| 116 | + mActionButtons[i].SetParentOrigin( ParentOrigin::CENTER ); | |
| 117 | + mActionButtons[i].SetAnchorPoint( ParentOrigin::CENTER ); | |
| 118 | + mActionButtons[i].SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); | |
| 119 | + mActionButtons[i].SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); | |
| 120 | + mActionIndex = mActionButtons[i].RegisterProperty( "actionId", i, Property::READ_WRITE ); | |
| 121 | + mActionButtons[i].ClickedSignal().Connect( this, &TransitionApplication::OnActionButtonClicked ); | |
| 122 | + actionButtonLayout.AddChild( mActionButtons[i], TableView::CellPosition( 0, 1+i ) ); | |
| 123 | + } | |
| 124 | + mActionButtons[0].SetLabelText( "Bounce" ); | |
| 125 | + mActionButtons[1].SetLabelText( "X" ); | |
| 126 | + mActionButtons[2].SetLabelText( "Y" ); | |
| 127 | + | |
| 128 | + contentLayout.Add( actionButtonLayout ); | |
| 129 | + contentLayout.SetFitHeight(2); | |
| 130 | +} | |
| 131 | + | |
| 132 | + | |
| 133 | +bool TransitionApplication::OnActionButtonClicked( Button button ) | |
| 134 | +{ | |
| 135 | + int action = button.GetProperty<int>( mActionIndex ); | |
| 136 | + switch( action ) | |
| 137 | + { | |
| 138 | + case 0: | |
| 139 | + { | |
| 140 | + mBeatControl.StartBounceAnimation(); | |
| 141 | + break; | |
| 142 | + } | |
| 143 | + case 1: | |
| 144 | + { | |
| 145 | + mBeatControl.StartXAnimation(); | |
| 146 | + break; | |
| 147 | + } | |
| 148 | + case 2: | |
| 149 | + { | |
| 150 | + mBeatControl.StartYAnimation(); | |
| 151 | + break; | |
| 152 | + } | |
| 153 | + } | |
| 154 | + | |
| 155 | + return true; | |
| 156 | +} | |
| 157 | + | |
| 158 | +void TransitionApplication::OnKeyEvent( const KeyEvent& keyEvent ) | |
| 159 | +{ | |
| 160 | + static int keyPressed = 0; | |
| 161 | + | |
| 162 | + if( keyEvent.state == KeyEvent::Down) | |
| 163 | + { | |
| 164 | + if( keyPressed == 0 ) // Is this the first down event? | |
| 165 | + { | |
| 166 | + printf("Key pressed: %s %d\n", keyEvent.keyPressedName.c_str(), keyEvent.keyCode ); | |
| 167 | + | |
| 168 | + if( IsKey( keyEvent, DALI_KEY_ESCAPE) || IsKey( keyEvent, DALI_KEY_BACK ) ) | |
| 169 | + { | |
| 170 | + mApplication.Quit(); | |
| 171 | + } | |
| 172 | + else if( keyEvent.keyPressedName.compare("Return") == 0 ) | |
| 173 | + { | |
| 174 | + } | |
| 175 | + } | |
| 176 | + keyPressed = 1; | |
| 177 | + } | |
| 178 | + else if( keyEvent.state == KeyEvent::Up ) | |
| 179 | + { | |
| 180 | + keyPressed = 0; | |
| 181 | + } | |
| 182 | +} | |
| 183 | + | |
| 184 | +} // namespace Demo | ... | ... |
examples/transitions/transition-application.h
0 → 100644
| 1 | +#ifndef DALI_DEMO_TRANSITION_APPLICATION_H | |
| 2 | +#define DALI_DEMO_TRANSITION_APPLICATION_H | |
| 3 | + | |
| 4 | +/* | |
| 5 | + * Copyright (c) 2016 Samsung Electronics Co., Ltd. | |
| 6 | + * | |
| 7 | + * Licensed under the Apache License, Version 2.0 (the "License"); | |
| 8 | + * you may not use this file except in compliance with the License. | |
| 9 | + * You may obtain a copy of the License at | |
| 10 | + * | |
| 11 | + * http://www.apache.org/licenses/LICENSE-2.0 | |
| 12 | + * | |
| 13 | + * Unless required by applicable law or agreed to in writing, software | |
| 14 | + * distributed under the License is distributed on an "AS IS" BASIS, | |
| 15 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 16 | + * See the License for the specific language governing permissions and | |
| 17 | + * limitations under the License. | |
| 18 | + */ | |
| 19 | + | |
| 20 | +// External includes | |
| 21 | +#include <dali-toolkit/dali-toolkit.h> | |
| 22 | +//#include <dali-toolkit/devel-api/controls/slider/slider.h> | |
| 23 | +#include <dali-toolkit/devel-api/controls/popup/popup.h> | |
| 24 | +#include "beat-control.h" | |
| 25 | +#include <cstdio> | |
| 26 | +#include <sstream> | |
| 27 | + | |
| 28 | +// Internal includes | |
| 29 | + | |
| 30 | +using namespace Dali; | |
| 31 | +using namespace Dali::Toolkit; | |
| 32 | + | |
| 33 | +namespace Demo | |
| 34 | +{ | |
| 35 | + | |
| 36 | +class TransitionApplication : public ConnectionTracker | |
| 37 | +{ | |
| 38 | +public: | |
| 39 | + // Constructor | |
| 40 | + TransitionApplication( Application& application ); | |
| 41 | + | |
| 42 | + // Destructor | |
| 43 | + ~TransitionApplication(); | |
| 44 | + | |
| 45 | + // Init signal handler | |
| 46 | + void Create( Application& application ); | |
| 47 | + | |
| 48 | + // Create the GUI components | |
| 49 | + Toolkit::TextLabel CreateTitle( std::string title ); | |
| 50 | + Actor CreateContentPane(); | |
| 51 | + | |
| 52 | + // Key event handler | |
| 53 | + void OnKeyEvent( const KeyEvent& event ); | |
| 54 | + | |
| 55 | + bool OnActionButtonClicked(Button button); | |
| 56 | + | |
| 57 | + static const char* DEMO_THEME_ONE_PATH; | |
| 58 | + | |
| 59 | +private: | |
| 60 | + Application& mApplication; | |
| 61 | + TextLabel mTitle; | |
| 62 | + BeatControl mBeatControl; | |
| 63 | + PushButton mActionButtons[3]; | |
| 64 | + Property::Index mActionIndex; | |
| 65 | +}; | |
| 66 | + | |
| 67 | +} // Namespace Demo | |
| 68 | + | |
| 69 | + | |
| 70 | +#endif // DALI_DEMO_TRANSITION_APPLICATION_H | ... | ... |
examples/transitions/transition-example.cpp
0 → 100644
| 1 | +/* | |
| 2 | + * Copyright (c) 2016 Samsung Electronics Co., Ltd. | |
| 3 | + * | |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | |
| 5 | + * you may not use this file except in compliance with the License. | |
| 6 | + * You may obtain a copy of the License at | |
| 7 | + * | |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | |
| 9 | + * | |
| 10 | + * Unless required by applicable law or agreed to in writing, software | |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 13 | + * See the License for the specific language governing permissions and | |
| 14 | + * limitations under the License. | |
| 15 | + */ | |
| 16 | + | |
| 17 | +/** | |
| 18 | + * @file transition-example.cpp | |
| 19 | + * @brief Example of stylable transitions. | |
| 20 | + */ | |
| 21 | + | |
| 22 | +// External includes | |
| 23 | +#include <dali/dali.h> | |
| 24 | + | |
| 25 | +// Internal includes | |
| 26 | +#include "transition-application.h" | |
| 27 | + | |
| 28 | + | |
| 29 | +/// Entry point for applications | |
| 30 | +int DALI_EXPORT_API main( int argc, char** argv ) | |
| 31 | +{ | |
| 32 | + const char* themeName = Demo::TransitionApplication::DEMO_THEME_ONE_PATH; | |
| 33 | + | |
| 34 | + Application application = Application::New( &argc, &argv, themeName ); | |
| 35 | + Demo::TransitionApplication transitionApplication( application ); | |
| 36 | + application.MainLoop(); | |
| 37 | + return 0; | |
| 38 | +} | ... | ... |
resources/po/en_GB.po
resources/po/en_US.po
resources/style/mobile/style-example-theme-one.json.in
| ... | ... | @@ -110,6 +110,70 @@ |
| 110 | 110 | "targetValue":[1,1,1] |
| 111 | 111 | } |
| 112 | 112 | ] |
| 113 | + }, | |
| 114 | + "BeatControl": | |
| 115 | + { | |
| 116 | + "beatVisual":{ | |
| 117 | + "visualType":"IMAGE", | |
| 118 | + "url":"{APPLICATION_RESOURCE_PATH}/images/Logo-for-demo.png" | |
| 119 | + }, | |
| 120 | + | |
| 121 | + "bounceTransition": | |
| 122 | + [ | |
| 123 | + { | |
| 124 | + "target":"beatVisual", | |
| 125 | + "property":"size", | |
| 126 | + "initialValue":[0.5, 0.5], | |
| 127 | + "targetValue":[0.75, 0.75], | |
| 128 | + "animator": | |
| 129 | + { | |
| 130 | + "alphaFunction":"BOUNCE", | |
| 131 | + "timePeriod": | |
| 132 | + { | |
| 133 | + "duration":0.5, | |
| 134 | + "delay":0 | |
| 135 | + } | |
| 136 | + } | |
| 137 | + } | |
| 138 | + ], | |
| 139 | + | |
| 140 | + "leftTransition": | |
| 141 | + [ | |
| 142 | + { | |
| 143 | + "target":"beatVisual", | |
| 144 | + "property":"offset", | |
| 145 | + "initialValue":[0, 0], | |
| 146 | + "targetValue":[0.25, 0], | |
| 147 | + "animator": | |
| 148 | + { | |
| 149 | + "alphaFunction":"BOUNCE", | |
| 150 | + "timePeriod": | |
| 151 | + { | |
| 152 | + "duration":0.5, | |
| 153 | + "delay":0 | |
| 154 | + } | |
| 155 | + } | |
| 156 | + } | |
| 157 | + ], | |
| 158 | + | |
| 159 | + "upTransition": | |
| 160 | + [ | |
| 161 | + { | |
| 162 | + "target":"beatVisual", | |
| 163 | + "property":"offset", | |
| 164 | + "initialValue":[0, 0], | |
| 165 | + "targetValue":[0, 0.25], | |
| 166 | + "animator": | |
| 167 | + { | |
| 168 | + "alphaFunction":"BOUNCE", | |
| 169 | + "timePeriod": | |
| 170 | + { | |
| 171 | + "duration":0.5, | |
| 172 | + "delay":0 | |
| 173 | + } | |
| 174 | + } | |
| 175 | + } | |
| 176 | + ] | |
| 113 | 177 | } |
| 114 | 178 | } |
| 115 | 179 | } | ... | ... |
resources/style/style-example-theme-one.json.in
| ... | ... | @@ -110,6 +110,70 @@ |
| 110 | 110 | "targetValue":[1,1,1] |
| 111 | 111 | } |
| 112 | 112 | ] |
| 113 | + }, | |
| 114 | + "BeatControl": | |
| 115 | + { | |
| 116 | + "beatVisual":{ | |
| 117 | + "visualType":"IMAGE", | |
| 118 | + "url":"{APPLICATION_RESOURCE_PATH}/images/Logo-for-demo.png" | |
| 119 | + }, | |
| 120 | + | |
| 121 | + "bounceTransition": | |
| 122 | + [ | |
| 123 | + { | |
| 124 | + "target":"beatVisual", | |
| 125 | + "property":"size", | |
| 126 | + "initialValue":[0.5, 0.5], | |
| 127 | + "targetValue":[0.75, 0.75], | |
| 128 | + "animator": | |
| 129 | + { | |
| 130 | + "alphaFunction":"BOUNCE", | |
| 131 | + "timePeriod": | |
| 132 | + { | |
| 133 | + "duration":0.5, | |
| 134 | + "delay":0 | |
| 135 | + } | |
| 136 | + } | |
| 137 | + } | |
| 138 | + ], | |
| 139 | + | |
| 140 | + "leftTransition": | |
| 141 | + [ | |
| 142 | + { | |
| 143 | + "target":"beatVisual", | |
| 144 | + "property":"offset", | |
| 145 | + "initialValue":[0, 0], | |
| 146 | + "targetValue":[0.25, 0], | |
| 147 | + "animator": | |
| 148 | + { | |
| 149 | + "alphaFunction":"BOUNCE", | |
| 150 | + "timePeriod": | |
| 151 | + { | |
| 152 | + "duration":0.5, | |
| 153 | + "delay":0 | |
| 154 | + } | |
| 155 | + } | |
| 156 | + } | |
| 157 | + ], | |
| 158 | + | |
| 159 | + "upTransition": | |
| 160 | + [ | |
| 161 | + { | |
| 162 | + "target":"beatVisual", | |
| 163 | + "property":"offset", | |
| 164 | + "initialValue":[0, 0], | |
| 165 | + "targetValue":[0, 0.25], | |
| 166 | + "animator": | |
| 167 | + { | |
| 168 | + "alphaFunction":"BOUNCE", | |
| 169 | + "timePeriod": | |
| 170 | + { | |
| 171 | + "duration":0.5, | |
| 172 | + "delay":0 | |
| 173 | + } | |
| 174 | + } | |
| 175 | + } | |
| 176 | + ] | |
| 113 | 177 | } |
| 114 | 178 | } |
| 115 | 179 | } | ... | ... |
shared/dali-demo-strings.h
| ... | ... | @@ -82,6 +82,7 @@ extern "C" |
| 82 | 82 | #define DALI_DEMO_STR_TITLE_TEXT_SCROLLING dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_TEXT_SCROLLING") |
| 83 | 83 | #define DALI_DEMO_STR_TITLE_TILT_SENSOR dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_TILT_SENSOR") |
| 84 | 84 | #define DALI_DEMO_STR_TITLE_FPP_GAME dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_FPP_GAME") |
| 85 | +#define DALI_DEMO_STR_TITLE_VISUAL_TRANSITIONS dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_VISUAL_TRANSITIONS") | |
| 85 | 86 | |
| 86 | 87 | #else // !INTERNATIONALIZATION_ENABLED |
| 87 | 88 | |
| ... | ... | @@ -135,7 +136,7 @@ extern "C" |
| 135 | 136 | #define DALI_DEMO_STR_TITLE_TILT_SENSOR "Tilt Sensor" |
| 136 | 137 | #define DALI_DEMO_STR_TITLE_PROGRESS_BAR "Progress Bar" |
| 137 | 138 | #define DALI_DEMO_STR_TITLE_FPP_GAME "First Person Game" |
| 138 | - | |
| 139 | +#define DALI_DEMO_STR_TITLE_VISUAL_TRANSITIONS "Visual Transitions" | |
| 139 | 140 | #endif |
| 140 | 141 | |
| 141 | 142 | #ifdef __cplusplus | ... | ... |