Skip to content

Commit

Permalink
Funciona el alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
Viterbo committed Apr 29, 2016
1 parent 9f76aa0 commit af83967
Show file tree
Hide file tree
Showing 7 changed files with 238 additions and 31 deletions.
4 changes: 2 additions & 2 deletions games/card-suarez.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
"video": {
"type": "YoutubeVideo",
"videoid": "3zKoUda-WVA",
"autoplay": "1",
"allowfullscreen": "true",
"autoplay": true,
"allowfullscreen": true,
"maxWidth": "90%",
"minWidth": "50%",
"maxHeight": "90%",
Expand Down
23 changes: 19 additions & 4 deletions games/prueba.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@
},
"/btn1": {
"body_1": {
"alpha": 0,
"autoplay": true,
"alpha": 1,
"position": {
"my": "middle center",
"at": "middle center",
Expand Down Expand Up @@ -158,9 +159,23 @@
}
},
"body_1": {
"class": "big-block",
"fillStyle": "#700"
},
"type": "YoutubeVideo",
"videoid": "3zKoUda-WVA",
"autoplay": false,
"allowfullscreen": true,
"maxWidth": "90%",
"minWidth": "50%",
"maxHeight": "90%",
"minHeight": "50%",
"width": "800",
"height": "600",
"aspectRatio": "1.778",
"alpha": 0,
"tween": {
"time": 250,
"ease": "Quad.easeOut"
}
},
"body_2": {
"class": "big-block",
"fillStyle": "#770"
Expand Down
185 changes: 174 additions & 11 deletions games/treens.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,185 @@
{
"preload": {
"background":"images/Luis-Suarez-uruguay-best-striker.jpg"
"class": {
"big-block": {
"type": "BitmapData",
"width": "50%",
"height": "50%",
"alpha": 0,
"tween": {
"time": 250,
"ease": "Quad.easeOut"
}
},
"block": {
"type": "BitmapData",
"width": "50",
"height": "20"
}
},
"scenes": {
"card": {
"autostart": true,
"children": {
"background": {
"type": "Sprite",
"width": "50%",
"height": "50%",
"texture": "background",
"scene": {
"autostart": true,
"sections": {
"/": {
"btn_1": {
"position": {
"my": "top left",
"at": "top left",
"of": "parent"
}
},
"btn_2": {
"position": {
"my": "top left",
"at": "top right",
"of": "parent.btn_1"
}
},
"btn_3": {
"position": {
"my": "top left",
"at": "top right",
"of": "parent.btn_2"
}
},
"btn_4": {
"position": {
"my": "top left",
"at": "top right",
"of": "parent.btn_3"
}
},
"body_1": {
"position": {
"my": "middle left",
"at": "middle right",
"of": "parent"
}
},
"body_2": {
"position": {
"my": "middle left",
"at": "middle right",
"of": "parent"
}
},
"body_3": {
"position": {
"my": "middle left",
"at": "middle right",
"of": "parent"
}
},
"body_4": {
"position": {
"my": "middle left",
"at": "middle right",
"of": "parent"
}
}
},
"/btn1": {
"body_1": {
"position": {
"my": "middle center",
"at": "middle center",
"of": "parent"
}
}
},
"/btn2": {
"body_2": {
"alpha": 1,
"position": {
"my": "middle center",
"at": "middle center",
"of": "parent"
}
}
},
"/btn3": {
"body_3": {
"alpha": 1,
"position": {
"my": "middle center",
"at": "middle center",
"of": "parent"
}
}
},
"/btn4": {
"body_4": {
"alpha": 1,
"position": {
"my": "middle center",
"at": "middle center",
"of": "parent"
}
}
}
},
"children_": {
"body_1": {
"class": "big-block",
"fillStyle": "#700"
}
},
"children": {
"btn_1": {
"class": "block",
"fillStyle": "#F00",
"onInputDown": {
"handler": "scene-enter-section",
"params": "/btn1"
}
},
"btn_2": {
"class": "block",
"fillStyle": "#FF0",
"onInputDown": {
"handler": "scene-enter-section",
"params": "/btn2"
}
},
"btn_3": {
"class": "block",
"fillStyle": "#F0F",
"onInputDown": {
"handler": "scene-enter-section",
"params": "/btn3"
}
},
"btn_4": {
"class": "block",
"fillStyle": "#0F0",
"onInputDown": {
"handler": "scene-enter-section",
"params": "/btn4"
}
},
"body_1": {
"type": "YoutubeVideo",
"videoid": "3zKoUda-WVA",
"autoplay": false,
"allowfullscreen": true,
"maxWidth": "90%",
"minWidth": "50%",
"maxHeight": "90%",
"minHeight": "50%",
"width": "800",
"height": "600",
"aspectRatio": "1.778"
},
"body_2": {
"class": "big-block",
"fillStyle": "#770"
},
"body_3": {
"class": "big-block",
"fillStyle": "#707"
},
"body_4": {
"class": "big-block",
"fillStyle": "#070"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<script src="app.js"></script>
</head>
<style>
body, html { margin: 0px; background-color: cornflowerblue; }
body, html { overflow: hidden; margin: 0px; background-color: cornflowerblue; }
</style>
<body>
</body>
Expand Down
42 changes: 31 additions & 11 deletions lib/jwebkit.js
Original file line number Diff line number Diff line change
Expand Up @@ -975,14 +975,20 @@ BaseStrategy.prototype._tq_id = function (node, new_id) {
var reg = new RegExp("(?:^|\\s)" + classname + "(?!\\S)");
return !!node.className.match(reg);
},
_tq_get_css: function (node, key) {
return node.style[key]
},
_tq_set_css: function (node, key, value) {
return node.style[key] = value;
},
_tq_get_attr: function (node, key) {
console.assert(this._tq_accepts(node), node);
console.assert(typeof key == "string", arguments);
return node.getAttribute(key);
},
_tq_set_attr: function (node, key, value) {
console.assert(this._tq_accepts(node), node);
console.assert(typeof key == "string", arguments);
console.assert(typeof key == "string", arguments);
return node.setAttribute(key, value);
},
_tq_map_attr: function (node) {
Expand Down Expand Up @@ -1074,29 +1080,20 @@ BaseStrategy.prototype._tq_id = function (node, new_id) {
},
_tq_offset: function (node, new_value) {
if (new_value) {
if (typeof new_value == "number") {
new_value = new_value + "px";
}
node.style.width= new_value;
return this;
}
return node.offsetWidth();
},
_tq_width: function (node, new_value) {
if (new_value) {
if (typeof new_value == "number") {
new_value = new_value + "px";
}
node.style.width= new_value;
return this;
}
return node.offsetWidth();
},
_tq_height: function (node, new_value) {
_tq_height: function (node, new_value) {
if (new_value) {
if (typeof new_value == "number") {
new_value = new_value + "px";
}
node.style.height = new_value;
return this;
}
Expand Down Expand Up @@ -1185,6 +1182,29 @@ BaseStrategy.prototype._tq_id = function (node, new_id) {
hasClass: function (classname) {
return this._tq_strategy._tq_has_class(this[0], classname);
},
css: function (key, val) {
if (arguments.length == 1) {
if (typeof key == "object") {
for (var i in key) {
this.css(i, key[i]);
}
return this;
}

if (typeof key == "string") {
if (this.length == 0) return null;
return self._tq_strategy._tq_set_css(this[0], key, val);
}
}

if (arguments.length == 2 && typeof key == "string") {
return this.each(function (element,index,self) {
self._tq_strategy._tq_set_css(element, key, val);
});
}

return this;
},
attr: function (key, value) {

if (arguments.length == 1 && typeof key == "string") {
Expand Down
11 changes: 10 additions & 1 deletion src/dom_wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ LightSaber.DOM_Wrapper.prototype = jwk.extend(Object.create(LightSaber.DisplayOb
this._last_parent_y != this.parent.y ||
this._last_self_x != this.x ||
this._last_self_y != this.y
) {
) {
this._last_parent_x = this.parent.x;
this._last_parent_y = this.parent.y;
this._last_self_x = this.x;
Expand Down Expand Up @@ -52,6 +52,15 @@ LightSaber.DOM_Wrapper.prototype = jwk.extend(Object.create(LightSaber.DisplayOb
"rotate(" + this.angle + "deg) translate("+(-x)+"%,"+(-y)+"%)";
this._$element[0].style.transform = t;
}

if (this._last_alpha != this.alpha ||
this._last_alpha != this.alpha
) {
this._last_alpha = this.alpha;
this._$element.css("opacity", this.alpha);
}


},
resize: function (){
LightSaber.DisplayObject.prototype.resize.call(this);
Expand Down
2 changes: 1 addition & 1 deletion src/lightsaber.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ LightSaber.prototype = {
saber.enter_section(target.spec[event_name].params);
break;
}
}
}
},
extend_spec: function (spec) {
var self = this;
Expand Down

0 comments on commit af83967

Please sign in to comment.