From 163ffbf531872a81c4d4be4321b065c22cf0715b Mon Sep 17 00:00:00 2001
From: Eric Guzman
Date: Fri, 16 Mar 2012 17:09:08 -0700
Subject: Presets Panel - Adding Animations Tab
---
.../animations-presets.reel/animations-presets.css | 5 ++
.../animations-presets.html | 59 +++++++++++++++++
.../animations-presets.reel/animations-presets.js | 73 ++++++++++++++++++++++
3 files changed, 137 insertions(+)
create mode 100644 js/panels/presets/animations-presets.reel/animations-presets.css
create mode 100644 js/panels/presets/animations-presets.reel/animations-presets.html
create mode 100644 js/panels/presets/animations-presets.reel/animations-presets.js
(limited to 'js/panels/presets/animations-presets.reel')
diff --git a/js/panels/presets/animations-presets.reel/animations-presets.css b/js/panels/presets/animations-presets.reel/animations-presets.css
new file mode 100644
index 00000000..0441c1cf
--- /dev/null
+++ b/js/panels/presets/animations-presets.reel/animations-presets.css
@@ -0,0 +1,5 @@
+/*
+ This file contains proprietary software owned by Motorola Mobility, Inc.
+ No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+ (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
+ */
\ No newline at end of file
diff --git a/js/panels/presets/animations-presets.reel/animations-presets.html b/js/panels/presets/animations-presets.reel/animations-presets.html
new file mode 100644
index 00000000..c9d752af
--- /dev/null
+++ b/js/panels/presets/animations-presets.reel/animations-presets.html
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/js/panels/presets/animations-presets.reel/animations-presets.js b/js/panels/presets/animations-presets.reel/animations-presets.js
new file mode 100644
index 00000000..ab200212
--- /dev/null
+++ b/js/panels/presets/animations-presets.reel/animations-presets.js
@@ -0,0 +1,73 @@
+/*
+ This file contains proprietary software owned by Motorola Mobility, Inc.
+ No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+ (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
+ */
+
+var Montage = require("montage/core/core").Montage,
+ Component = require("montage/ui/component").Component,
+ DefaultPresets = require("js/panels/presets/default-animation-presets").animationPresets;
+
+exports.AnimationsLibrary = Montage.create(Component, {
+ hasTemplate: {
+ value: true
+ },
+ presetData : {
+ value: null
+ },
+ deserializedFromTemplate : {
+ value: function() {
+ this.presetData = DefaultPresets;
+ }
+ },
+ handleNodeActivation: {
+ value: function(presetData) {
+ //debugger;
+ var selection = this.application.ninja.selectedElements,
+ stylesController = this.application.ninja.stylesController,
+ selectorBase = presetData.selectorBase,
+ self = this;
+
+ if(!selection || !selection.length || selection.length === 0) {
+ return false;
+ }
+
+ selectorBase = stylesController.generateClassName(selectorBase);
+
+ presetData.rules.forEach(function(rule) {
+ if(rule.isKeyFrameRule) {
+ this.application.ninja.stylesController.addRule(
+ '@-webkit-keyframes ' + presetData.selectorBase,
+ this.stringifyKeys(rule.keys)
+ );
+ } else {
+ this.application.ninja.stylesController.addRule('.' + selectorBase + rule.selectorSuffix, rule.styles);
+ }
+
+ }, this);
+
+ selection.forEach(function(el) {
+ el._element.classList.add(selectorBase);
+ }, this);
+
+ }
+ },
+
+ stringifyKeys : {
+ value: function(keysArray) {
+ var keysString = '';
+
+ keysArray.forEach(function(key) {
+ var styles = '', style;
+
+ for(style in key.styles) {
+ styles += style + ':' + key.styles[style] + '; ';
+ }
+
+ keysString += key.keyText + ' {' + styles + ' }';
+ });
+
+ return keysString;
+ }
+ }
+});
--
cgit v1.2.3