feature/coffeescript
Sven Slootweg 10 years ago
parent 3713464ecb
commit b379187f4f

@ -708,11 +708,9 @@
this.value = this.start;
this.last_updated = this.start_frame;
this.finished = false;
console.log(this);
}
Ease.prototype.goToNext = function() {
console.log("next", this.next);
this.func = this[this.next.type];
this.change = this.next.change;
this.value = this.next.value;
@ -722,6 +720,7 @@
this.change = this.next.change;
this.invert_repeat = this.next.invert_repeat;
this.params = this.next.params;
this.duration = this.next.duration;
this.finished = false;
return this.next = this.next.next;
};

@ -115,7 +115,7 @@ $(->
diamond.onMouseOver = ->
#@fade_decay_current = 1
@fade_value = @engine.ease.circOut(0, 1, 30, @engine.ease.bounceOut(1, 0, 45))
@fade_value = @engine.ease.circOut(0, 1, 10, @engine.ease.bounceOut(1, 0, 35))
cursor = @engine.getObject("cursor").getInstances()[0]
cursor.x = @x - 9
@ -132,4 +132,4 @@ $(->
engine.start()
)
)
)

@ -93,7 +93,7 @@
});
};
diamond.onMouseOver = function() {
this.fade_value = this.engine.ease.circOut(0, 1, 30, this.engine.ease.bounceOut(1, 0, 45));
this.fade_value = this.engine.ease.circOut(0, 1, 10, this.engine.ease.bounceOut(1, 0, 35));
cursor = this.engine.getObject("cursor").getInstances()[0];
cursor.x = this.x - 9;
return cursor.y = this.y - 9;

@ -18,6 +18,8 @@ class Engine
@unnamed_timers = []
# The following is to make the engine object available in library methods
# FUTURE: Iterate over easing methods and create an engine-bound version
# in the local engine object, overriding the prototype methods?
@ease.engine = this
addCanvas: (canvas, label = "") =>
@ -132,4 +134,4 @@ class Engine
if typeof name == "string" then @sprites[name] else name
getTileset: (name) =>
if typeof name == "string" then @tilesets[name] else name
if typeof name == "string" then @tilesets[name] else name

@ -93,7 +93,6 @@ class Ease
@value = @start
@last_updated = @start_frame
@finished = false
console.log(this)
# TODO: Investigate whether JS engines cache deterministic outcomes by themselves. If not,
# the below could provide some performance gain.
#@bounce_constant_1 = 1 / 2.75
@ -101,7 +100,6 @@ class Ease
#@bounce_constant_3 = 2.5 / 2.75
goToNext: =>
console.log("next", @next)
@func = this[@next.type]
@change = @next.change
@value = @next.value
@ -111,6 +109,7 @@ class Ease
@change = @next.change
@invert_repeat = @next.invert_repeat
@params = @next.params
@duration = @next.duration
@finished = false
@next = @next.next
@ -195,4 +194,3 @@ class Ease
else
time = time - 2
return @change / 2 * (Math.sqrt(1 - time * time) + 1) + @begin
Loading…
Cancel
Save