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

Matrix3d #136

Open
wants to merge 27 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
342a574
New Google Closure Repo URL
May 14, 2014
a0600ad
Removed CSSTransitions From LimeJS
May 14, 2014
363dd29
removed setPrescision
May 14, 2014
663c7a1
removed set3dtransform
May 14, 2014
e0e4ebe
fix for non-uniform scales and rotations
May 14, 2014
a7bcd29
Merge branch 'master' into matrix3d
May 15, 2014
0327992
Merge remote-tracking branch 'upstream/master'
May 15, 2014
51e1f2f
missed an instance where transforms were multiplied in the wrong order.
May 15, 2014
1f3bc22
merged default into matrix3d branch
May 15, 2014
2c6c8aa
matrix3d working
May 16, 2014
1e3783a
backface visibility turned on. This has shown a 2x perf increase on …
May 16, 2014
c0d9dad
backface visibility turned on. This has shown a 2x perf increase on …
May 16, 2014
6829884
removed lime.style.Transform as it is not needed anymore
May 16, 2014
658aa58
Merge branch 'matrix3d' of https://github.com/stringa/limejs into mat…
May 16, 2014
f2a267a
removed containerElement
May 21, 2014
d51ddfb
trig tables for sine and cosine
Jun 1, 2014
09b5441
don't updated the actual 'Mask' element as it is not used by the rend…
Jun 1, 2014
6484b7f
reverted anim1 test changes
Jun 1, 2014
77aebca
reverted extra logging
Jun 1, 2014
489a22a
removed double inc. accidently committed.
Jun 2, 2014
ede8c00
removed old function
Jun 2, 2014
edf72d5
SetPrecision after calculating the mask position. These numbers can …
Jun 5, 2014
233cc2e
match the behavior of Math.cos(undefined) and Math.sin(undefined)
Jun 5, 2014
d97424d
Main fix for borders/strokes - Strokes affect the child.
Jun 13, 2014
6fe4962
Modified stroke2 test to include a rounded rect.
Jun 13, 2014
449a256
Pregenerate the Trig Tables, use them at runtime
Jun 13, 2014
3f09927
added comment about why i use toFixed
Jun 13, 2014
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
2 changes: 2 additions & 0 deletions lime/css/lime.css.soy
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
-o-transform-origin: 0 0;
image-rendering: optimizeSpeed;
overflow: hidden;
-webkit-backface-visibility:hidden; /* Chrome, Safari, Opera */
backface-visibility:hidden;
{rb}

.{css lime-director} div,
Expand Down
2 changes: 1 addition & 1 deletion lime/css/lime.css.soy.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lime/demos/roundball/board.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ rb.Board.prototype.checkSolutions = function() {
var action = new lime.animation.Spawn(
new lime.animation.ScaleTo(0),
new lime.animation.FadeTo(0).setDuration(.8)
).enableOptimizations();
);

goog.array.removeDuplicates(solutions);

Expand Down
2 changes: 1 addition & 1 deletion lime/demos/roundball/multimove.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ rb.MultiMove.prototype.play = function(opt_static) {
var action, longest_action, longest_duration = 0;
for (var i in this.requests_) {
var req = this.requests_[i];
action = new lime.animation.MoveBy(req[0][1]).setSpeed(.3).enableOptimizations();
action = new lime.animation.MoveBy(req[0][1]).setSpeed(.3);
if (longest_duration < action.getDuration()) {
longest_action = action;
longest_duration = action.getDuration();
Expand Down
2 changes: 1 addition & 1 deletion lime/demos/roundball/rb.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ rb.loadMenu = function() {

var btns = new lime.Layer().setPosition(0, 430);
layer.appendChild(btns);
var move = new lime.animation.MoveBy(-rb.WIDTH, 0).enableOptimizations();
var move = new lime.animation.MoveBy(-rb.WIDTH, 0);

var btn = rb.makeButton('Play Classic').setPosition(0, 200);
goog.events.listen(btn, 'click', function() {
Expand Down
52 changes: 26 additions & 26 deletions lime/demos/tests/anim1.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,45 +26,45 @@ test.HEIGHT = 400;

test.start = function() {

//director
test.director = new lime.Director(document.body, test.WIDTH, test.HEIGHT);
test.director.makeMobileWebAppCapable();
//director
test.director = new lime.Director(document.body, test.WIDTH, test.HEIGHT);
test.director.makeMobileWebAppCapable();


var menuscene = new lime.Scene;
var menuscene = new lime.Scene;

var layer = (new lime.Layer).setPosition(100, 100);
menuscene.appendChild(layer);
var layer = (new lime.Layer).setPosition(100, 100);
menuscene.appendChild(layer);


var sprite = new lime.Sprite().setFill(100,0,0).setSize(50, 50).setRenderer(lime.Renderer.CANVAS);
layer.appendChild(sprite);
var sprite = new lime.Sprite().setFill(100,0,0).setSize(50, 50).setRenderer(lime.Renderer.CANVAS);
layer.appendChild(sprite);

var anim = new lime.animation.Sequence(new lime.animation.Spawn(
new lime.animation.MoveBy(200, 0).setDuration(1.5),
new lime.animation.ScaleBy(2),
new lime.animation.ColorTo(0,200,0)

), new lime.animation.Spawn(
new lime.animation.MoveBy(-200, 0).setDuration(1.5),
new lime.animation.ScaleBy(.5),
new lime.animation.ColorTo(200,0,0)
var anim = new lime.animation.Sequence(new lime.animation.Spawn(
new lime.animation.MoveBy(200, 0).setDuration(1.5),
new lime.animation.ScaleBy(2),
new lime.animation.ColorTo(0,200,0)

));
sprite.runAction(new lime.animation.Loop(anim).setLimit(5));
), new lime.animation.Spawn(
new lime.animation.MoveBy(-200, 0).setDuration(1.5),
new lime.animation.ScaleBy(.5),
new lime.animation.ColorTo(200,0,0)

var sprite = new lime.Sprite().setFill('#0c0').setSize(50, 50).setPosition(0, 100).setRenderer(lime.Renderer.CANVAS);
layer.appendChild(sprite);
));
sprite.runAction(new lime.animation.Loop(anim).setLimit(5));

var anim = new lime.animation.Spawn(
new lime.animation.RotateBy(-90).setDuration(3).enableOptimizations(),
new lime.animation.MoveBy(300, 0).setDuration(3).enableOptimizations()
var sprite = new lime.Sprite().setFill('#0c0').setSize(50, 50).setPosition(0, 100).setRenderer(lime.Renderer.CANVAS);
layer.appendChild(sprite);

var anim = new lime.animation.Spawn(
new lime.animation.RotateBy(-90).setDuration(3),
new lime.animation.MoveBy(300, 0).setDuration(3)
);
var a2 = new lime.animation.Sequence(anim, anim.reverse());
sprite.runAction(new lime.animation.Loop(a2).setLimit(5));

// set active scene
test.director.replaceScene(menuscene);
// set active scene
test.director.replaceScene(menuscene);


};
Expand Down
2 changes: 1 addition & 1 deletion lime/demos/tests/anim2.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ test.start = function() {
.setPosition(300, 100)
.setScale(.3);

var flame_x = flame.getPosition().x;
//var flame_x = flame.getPosition().x;

flameLayer.appendChild(flame);

Expand Down
2 changes: 1 addition & 1 deletion lime/demos/tests/anim3.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ test.start = function() {
flameLayer.appendChild(flame);
flame.setFill(100, 0, 0).setPosition(0, 100).setSize(100, 100);

var move = new lime.animation.MoveBy(700, 0).setDuration(5).enableOptimizations()
var move = new lime.animation.MoveBy(700, 0).setDuration(5)
.setEasing(lime.animation.Easing.EASEINOUT);
move.addTarget(flame);
move.play();
Expand Down
4 changes: 2 additions & 2 deletions lime/demos/tests/anim4.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ test.start = function() {
scene.appendChild(circle2);

var moveRight2 = new lime.animation.MoveTo(874, 200)
.setDuration(774/100).setEasing(lime.animation.Easing.LINEAR).enableOptimizations();
.setDuration(774/100).setEasing(lime.animation.Easing.LINEAR);

var moveLeft2 = new lime.animation.MoveTo(100, 200)
.setDuration(774/100).setEasing(lime.animation.Easing.LINEAR).enableOptimizations();
.setDuration(774/100).setEasing(lime.animation.Easing.LINEAR);

circle2.runAction(new lime.animation.Loop(
new lime.animation.Sequence(
Expand Down
4 changes: 2 additions & 2 deletions lime/demos/tests/canvas2.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ test.makeLayerOfStuff = function(){
layer.appendChild(rrect);

var anim = new lime.animation.Spawn(
new lime.animation.ScaleBy(.3).setDuration(3).enableOptimizations(),
new lime.animation.MoveBy(0,-30).setDuration(3).enableOptimizations()
new lime.animation.ScaleBy(.3).setDuration(3),
new lime.animation.MoveBy(0,-30).setDuration(3)
);

rrect.runAction(
Expand Down
4 changes: 2 additions & 2 deletions lime/demos/tests/opacity.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ test.start = function() {
ball.setPosition(50, 100).setSize(100, 100);

ball.runAction(new lime.animation.Loop(new lime.animation.Sequence(
new lime.animation.FadeTo(0).setDuration(3).enableOptimizations(),
new lime.animation.FadeTo(1).setDuration(3).enableOptimizations()
new lime.animation.FadeTo(0).setDuration(3),
new lime.animation.FadeTo(1).setDuration(3)
)));


Expand Down
3 changes: 2 additions & 1 deletion lime/demos/tests/shapes2.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ goog.require('lime.Label');
goog.require('lime.Layer');
goog.require('lime.Scene');
goog.require('lime.animation.MoveBy');
goog.require('lime.RoundedRect');


test.WIDTH = 600;
Expand Down Expand Up @@ -41,7 +42,7 @@ test.start = function() {
flameLayer.appendChild(box);


var box2 = new lime.Sprite().setFill('#0c0').setSize(70, 70).setAnchorPoint(1, 1).setRotation(0).setPosition(0, 0);
var box2 = new lime.RoundedRect().setFill('#0c0').setSize(70, 70).setAnchorPoint(1, 1).setRotation(0).setPosition(0, 0);
goog.events.listen(box2, ['mousedown', 'touchstart'], dragFunc);
box.appendChild(box2);

Expand Down
2 changes: 1 addition & 1 deletion lime/demos/zlizer/bubble.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ zlizer.Bubble.prototype.updateFloatingSpeed = function() {

var delta = this.v.clone().scale(zlizer.BUBBLE_SPEED);

this.move = new lime.animation.MoveBy(delta.x, delta.y).setDuration(20).enableOptimizations().setEasing(lime.animation.Easing.LINEAR);
this.move = new lime.animation.MoveBy(delta.x, delta.y).setDuration(20).setEasing(lime.animation.Easing.LINEAR);
this.runAction(this.move);
};
4 changes: 2 additions & 2 deletions lime/demos/zlizer/game.js
Original file line number Diff line number Diff line change
Expand Up @@ -467,8 +467,8 @@ zlizer.Game.prototype.combine = function(bubs) {
sumcoord[1] /= bubs.length;

var anim = new lime.animation.Spawn(
new lime.animation.MoveTo(sumcoord[0], sumcoord[1]).enableOptimizations(),
new lime.animation.FadeTo(0).enableOptimizations()
new lime.animation.MoveTo(sumcoord[0], sumcoord[1]),
new lime.animation.FadeTo(0)
);
for (var i = 0; i < bubs.length; i++) {
anim.addTarget(bubs[i]);
Expand Down
4 changes: 2 additions & 2 deletions lime/demos/zlizer/zlizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ zlizer.loadMenuScene = function(opt_transition) {
var btn_levels = new zlizer.Button('PICK LEVEL').setPosition(0, 480).setSize(250, 100);
contents.appendChild(btn_levels);
goog.events.listen(btn_levels, lime.Button.Event.CLICK, function() {
contents.runAction(new lime.animation.MoveTo(0, -255).enableOptimizations());
contents.runAction(new lime.animation.MoveTo(0, -255));
});

var levels = new lime.Layer().setPosition(0, 690);
Expand Down Expand Up @@ -98,7 +98,7 @@ zlizer.loadMenuScene = function(opt_transition) {
var btn_main = new zlizer.Button('Back to Menu').setSize(400, 80).setPosition(250, r * 90);
btns_layer.appendChild(btn_main);
goog.events.listen(btn_main, lime.Button.Event.CLICK, function() {
contents.runAction(new lime.animation.MoveTo(0, 280).enableOptimizations());
contents.runAction(new lime.animation.MoveTo(0, 280));
},false, num);

};
Expand Down
36 changes: 1 addition & 35 deletions lime/src/animation/animation.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,6 @@ lime.animation.Animation.prototype.play = function() {
*/
lime.animation.Animation.prototype.stop = function() {
if (this.status_ != 0) {
var targets = this.initTargets_;
if (this.useTransitions() && this.clearTransition) {
var i = targets.length;
while (--i >= 0) {
this.clearTransition(targets[i]);
}
}
this.initTargets_ = [];
this.targetProp_ = {};
this.status_ = 0;
Expand Down Expand Up @@ -239,33 +232,6 @@ lime.animation.Animation.prototype.updateAll = function(t,targets){
return t;
};

/**
* Returns true if CSS transitions are used to make the animation.
* Performes better on iOS devices.
* @return {boolean} Transitions are being used?
*/
lime.animation.Animation.prototype.useTransitions = function() {
// Basically everything except Mobile/Desktop Safari seems broken.
return lime.userAgent.IOS && this.duration_ > 0 &&
lime.style.isTransitionsSupported && this.optimizations_;
/*
// goog.userAgent.MOBILE && // I see no boost on mac, only on iOS
!lime.userAgent.ANDROID && // bug in 2.2 http://code.google.com/p/android/issues/detail?id=12451
!goog.userAgent.GECKO; // still many bugs on FF4Beta Mac when hardware acceleration in ON*/
};

/**
* Enable CSS3 transitions to make animation. Usually performes better
* but is limited to single parallel transform action.
* @param {boolean=} opt_value Enable or disable.
* @return {lime.animation.Animation} object itself.
*/
lime.animation.Animation.prototype.enableOptimizations = function(opt_value) {
var bool = goog.isDef(opt_value) ? opt_value : true;
this.optimizations_ = bool;
return this;
};

/**
* Update targets to new values
* @param {number} t Time position of animation[0-1].
Expand All @@ -278,7 +244,7 @@ lime.animation.Animation.prototype.update = goog.abstractMethod;
* @protected
*/
lime.animation.Animation.prototype.cloneParam = function(origin){
return this.setDuration(origin.getDuration()).enableOptimizations(origin.optimizations_);
return this.setDuration(origin.getDuration());
};

/**
Expand Down
17 changes: 0 additions & 17 deletions lime/src/animation/fadeto.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,7 @@ lime.animation.FadeTo.prototype.scope = 'fade';
*/
lime.animation.FadeTo.prototype.makeTargetProp = function(target) {
var op = target.getOpacity();
if (this.useTransitions()) {
target.addTransition(lime.Transition.OPACITY,
this.opacity_,
this.duration_, this.getEasing());

target.setDirty(lime.Dirty.ALPHA);
}
return {startOpacity: op, delta: this.opacity_ - op };
};

Expand All @@ -51,14 +45,3 @@ lime.animation.FadeTo.prototype.update = function(t, target) {

};

/**
* Clear transistion when animation is stoped.
* @param {lime.Node} target The target to clear transistion for.
*/
lime.animation.FadeTo.prototype.clearTransition = function(target) {
if (this.useTransitions()) {
target.clearTransition(lime.Transition.OPACITY);
target.setDirty(lime.Dirty.ALPHA);
}
};

20 changes: 0 additions & 20 deletions lime/src/animation/moveby.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,6 @@ lime.animation.MoveBy.prototype.setSpeed = function(speed) {
* @see lime.animation.Animation#makeTargetProp
*/
lime.animation.MoveBy.prototype.makeTargetProp = function(target) {
if (this.useTransitions()) {
target.addTransition(lime.Transition.POSITION,
goog.math.Coordinate.sum(target.getPosition(), this.delta_),
this.duration_, this.getEasing());
target.setDirty(lime.Dirty.POSITION);
}
return {startpos: target.getPosition()};
};

Expand Down Expand Up @@ -86,20 +80,6 @@ lime.animation.MoveBy.prototype.update = function(t, target) {

};

/**
* Clear previously set transition values.
* @param {lime.Node} target Target node.
*/
lime.animation.MoveBy.prototype.clearTransition = function(target) {

if (this.useTransitions()) {
target.clearTransition(lime.Transition.POSITION);
target.setDirty(lime.Dirty.POSITION);
}


};

/**
* @inheritDoc
* @see lime.animation.Animation#reverse
Expand Down
19 changes: 0 additions & 19 deletions lime/src/animation/moveto.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,6 @@ lime.animation.MoveTo.prototype.makeTargetProp = function(target) {
var delta = new goog.math.Coordinate(
this.position_.x - start.x,
this.position_.y - start.y);

if (this.useTransitions()) {
target.addTransition(lime.Transition.POSITION,
this.position_,
this.duration_, this.getEasing());
target.setDirty(lime.Dirty.POSITION);
}

return {startpos: start, delta: delta};
};
Expand Down Expand Up @@ -94,15 +87,3 @@ lime.animation.MoveTo.prototype.update = function(t, target) {
);
};

/**
* Clear transistion when animation is stoped.
* @see lime.animation.Animation#clearTransition
* @param {lime.Node} target The target to clear transistion for.
*/
lime.animation.MoveTo.prototype.clearTransition = function(target) {
if (this.useTransitions()) {
target.clearTransition(lime.Transition.POSITION);
target.setDirty(lime.Dirty.POSITION);
}
};

Loading