Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Animatable Size #86

Open
wants to merge 25 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
aef28a7
Added animations sample
Jul 23, 2017
e0fd5aa
Disabled forced appSettings.json loading
Jul 23, 2017
1a0789a
Cleaned up default params
Jul 23, 2017
bff9ade
Renamed appSettings.json to settings.json; Added support to collapse …
Jul 23, 2017
b8c8cfd
Minor readme tweaks
Jul 23, 2017
ee29345
Removed center getter/setter (too many side-effects for refactoring)
Jul 23, 2017
300c94d
Removed inline functions for easier maintenance
Jul 23, 2017
5205931
Added templates to assist with Anim<T>, T operators
Jul 23, 2017
4bd61e1
Added Anim<T> conversion helpers
Jul 23, 2017
0ad3333
Implemented size animation for text view
Jul 23, 2017
a53b9e1
Made image and text view size anim compatible
Jul 23, 2017
b24d381
Implemented size anim for FboView
Jul 23, 2017
95245ae
Added ellipse view
Jul 23, 2017
3020d3c
Implemented >, <, >=, <= for Anim<T>
Jul 23, 2017
954af02
Made invalidation bit checks more robus
Jul 23, 2017
18cf1c1
Fixed json reference in cinderblock.xml
Jul 24, 2017
afb14b2
Added getRotationZ() to base view
Jul 24, 2017
01fad96
Renamed AnimationUtils.h to AnimOperators.h
Jul 25, 2017
5025b0f
Made all AnimOperators inline
Jul 25, 2017
776d54e
Fixed issue with TextViews that have no size set
Jul 26, 2017
757cd17
Fixed issues with unset sizes
Jul 26, 2017
c09d5e1
Fixed ci::Anim<T> - U operator (order was flipped)
Jul 27, 2017
d1c1a2f
Image/TextView now properly mark themselves as validated
Jul 27, 2017
8a8beab
Fixed ci::Anim<T> - T operator (order was flipped)
Jul 27, 2017
6852d12
Fixed issues with textview width/height 0; Expanded on textview sample
Jul 27, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ void BaseAppSampleApp::prepareSettings(ci::app::App::Settings* settings) {
SettingsManager::setInstance(myApp::MyAppSettingsManager::getInstance());

// Initialize the settings manager with the cinder app settings and the settings json
SettingsManager::getInstance()->setup(settings, ci::app::getAssetPath("appSettings.json"), [](SettingsManager * manager) {
SettingsManager::getInstance()->setup(settings, ci::app::getAssetPath("settings.json"), [](SettingsManager * manager) {
// Optional: Override json defaults at runtime
manager->mFullscreen = false;
manager->mWindowSize = ivec2(1280, 720);
Expand All @@ -105,9 +105,11 @@ void BaseAppSampleApp::prepareSettings(ci::app::App::Settings* settings) {
void BaseAppSampleApp::setup() {

BaseApp::setup();

// Optional: Add touch simulator support
BaseApp::addTouchSimulatorParams();

// Optional: configure your root view
// Optional: Configure your root view
getRootView()->setBackgroundColor(Color::gray(0.5f));

// Sample content
Expand Down
1 change: 1 addition & 0 deletions assets/appSettings.json → assets/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"drawMinimap": true,
"drawTouches": false,
"minimizeParams": true,
"collapseParams": false,
"drawScreenLayout": false
},
"touch": {
Expand Down
2 changes: 1 addition & 1 deletion cinderblock.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<requires>org.libcinder.tuio</requires>
<requires>com.bluecadet.cinder.text</requires>

<asset>assets/appSettings.json</asset>
<asset>assets/settings.json</asset>

<headerPattern>src/*.h</headerPattern>
<sourcePattern>src/*.cpp</sourcePattern>
Expand Down
Binary file added samples/AnimationsSample/assets/cinderblock.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions samples/AnimationsSample/include/Resources.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#pragma once
#include "cinder/CinderResources.h"

//#define RES_MY_RES CINDER_RESOURCE( ../resources/, image_name.png, 128, IMAGE )



Binary file not shown.
118 changes: 118 additions & 0 deletions samples/AnimationsSample/src/AnimationsSampleApp.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
#include "cinder/app/App.h"
#include "cinder/app/RendererGl.h"
#include "cinder/gl/gl.h"
#include "cinder/Rand.h"

#include "bluecadet/core/BaseApp.h"

#include "bluecadet/views/TextView.h"
#include "bluecadet/views/TouchView.h"
#include "bluecadet/views/ImageView.h"
#include "bluecadet/views/FboView.h"
#include "bluecadet/views/EllipseView.h"

using namespace ci;
using namespace ci::app;
using namespace std;

using namespace bluecadet::core;
using namespace bluecadet::views;
using namespace bluecadet::touch;

class AnimationsSampleApp : public BaseApp {
public:
static void prepareSettings(ci::app::App::Settings* settings);
void setup() override;
void update() override;
void draw() override;
};

void AnimationsSampleApp::prepareSettings(ci::app::App::Settings* settings) {
SettingsManager::getInstance()->setup(settings, [](SettingsManager * manager) {
manager->mFullscreen = false;
manager->mWindowSize = ivec2(960, 540);
manager->mConsoleWindowEnabled = false;
manager->mMinimizeParams = true;
manager->mCollapseParams = true;
});
}

void AnimationsSampleApp::setup() {
BaseApp::setup();

addTouchSimulatorParams();

vector<BaseViewRef> views;

{
auto textView = make_shared<TextView>();
textView->setText("Lorem ipsum dolor sit amet, consectetur adipiscing elit. \
Donec ornare mi ut nulla iaculis accumsan. Sed placerat vitae nisl at lobortis. \
Proin facilisis augue nec sodales sagittis. Lorem ipsum dolor sit amet, consectetur \
adipiscing elit. Donec ornare mi ut nulla iaculis accumsan. Sed placerat vitae nisl \
at lobortis. Proin facilisis augue nec sodales sagittis.Lorem ipsum dolor sit amet, \
consectetur adipiscing elit. Donec ornare mi ut nulla iaculis accumsan. Sed placerat \
vitae nisl at lobortis. Proin facilisis augue nec sodales sagittis.");
textView->setTextColor(Color::white());
views.push_back(textView);
}

{
auto imageView = make_shared<ImageView>();
auto image = loadImage(getAssetPath("cinderblock.png"));
auto texture = gl::Texture::create(image);
imageView->setTexture(texture);
views.push_back(imageView);
}

{
auto imageView = make_shared<ImageView>();
auto image = loadImage(getAssetPath("cinderblock.png"));
auto texture = gl::Texture::create(image);
imageView->setTexture(texture);

auto fboView = make_shared<FboView>();
fboView->addChild(imageView);
views.push_back(fboView);
}

{
auto ellipseView = make_shared<EllipseView>();
ellipseView->setSmoothness(50.0f);
ellipseView->setTransformOrigin(vec2(220, 110));
views.push_back(ellipseView);
}

float numCols = 2;
float numRows = 2;
float widthPerView = getWindowWidth() / numCols;
float heightPerView = getWindowHeight() / numRows;
float delayPerView = 0.1f;
for (float i = 0; i < views.size(); ++i) {
auto view = views[(int)i];
float col = glm::floor(glm::mod(i, numCols));
float row = glm::floor(i / numRows);

view->setBackgroundColor(hsvToRgb(vec3(randFloat(), 0.8f, 1.0f)));
view->setPosition(vec2(col * widthPerView, row * heightPerView) + view->getTransformOrigin());
view->setSize(vec2(widthPerView, heightPerView));

view->getTimeline()->apply(&view->getSize(), view->getSize() * vec2(0.33f, 0.66f), 2.0f, easeInOutQuad)
.loop(true).pingPong(true).delay(i / (float)views.size());

getRootView()->addChild(view);
}
}

void AnimationsSampleApp::update() {
// Optional override. BaseApp::update() will update all views.
BaseApp::update();
}

void AnimationsSampleApp::draw() {
// Optional override. BaseApp::draw() will draw all views.
BaseApp::draw();
}

// Make sure to pass a reference to prepareSettings to configure the app correctly. MSAA and other render options are optional.
CINDER_APP(AnimationsSampleApp, RendererGl(RendererGl::Options().msaa(4)), AnimationsSampleApp::prepareSettings);
26 changes: 26 additions & 0 deletions samples/AnimationsSample/vc2013/AnimationsSample.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AnimationsSample", "AnimationsSample.vcxproj", "{F74AEFC9-E3D2-43FA-B133-4503AE34DBBE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
Debug|x64 = Debug|x64
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F74AEFC9-E3D2-43FA-B133-4503AE34DBBE}.Debug|Win32.ActiveCfg = Debug|Win32
{F74AEFC9-E3D2-43FA-B133-4503AE34DBBE}.Debug|Win32.Build.0 = Debug|Win32
{F74AEFC9-E3D2-43FA-B133-4503AE34DBBE}.Release|Win32.ActiveCfg = Release|Win32
{F74AEFC9-E3D2-43FA-B133-4503AE34DBBE}.Release|Win32.Build.0 = Release|Win32
{F74AEFC9-E3D2-43FA-B133-4503AE34DBBE}.Debug|x64.ActiveCfg = Debug|x64
{F74AEFC9-E3D2-43FA-B133-4503AE34DBBE}.Debug|x64.Build.0 = Debug|x64
{F74AEFC9-E3D2-43FA-B133-4503AE34DBBE}.Release|x64.ActiveCfg = Release|x64
{F74AEFC9-E3D2-43FA-B133-4503AE34DBBE}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
Loading