Skip to content

Instantly share code, notes, and snippets.

@restorer
Last active August 29, 2015 14:21
Show Gist options
  • Save restorer/ff00b1d7f97cd3504033 to your computer and use it in GitHub Desktop.
Save restorer/ff00b1d7f97cd3504033 to your computer and use it in GitHub Desktop.
package ;
class Test {
public function testShake(view:View):Tween {
return tweenManager.serial([
tweenManager.tween(view).toFloat({ offsetX: -5 }),
tweenManager.tween(view).toFloat({ offsetX: 5 }),
tweenManager.tween(view).toFloat({ offsetX: -5 }),
tweenManager.tween(view).toFloat({ offsetX: 5 }),
tweenManager.tween(view).toFloat({ offsetX: 0 }),
]).childDuration(0.05).childEase(Ease.linear);
}
public function testOther():Void {
tweenManager.parallel([
tweenManager.tween(leftPhotoImageView).toFloat({ alpha: 1.0 }),
tweenManager.tween(rightPhotoImageView).toFloat({ alpha: 0.25 }),
]).childDuration(0.5);
// ----
tweenManager.serial([
tweenManager.tween(catView).toFloat({ offsetY: -5.0 }),
tweenManager.tween(catView).toFloat({ offsetY: 5.0 }),
]).childDuration(2.0).childEase(Ease.sineInOut).repeat();
// ----
tweenManager.ofTarget(viewGroup).finish();
// ----
tweenManager.tweens.stop();
// ----
tweenManager.tween(playerCellOverlay, COLOR_DURATION).toColor({
color: (canPlaceShip(sector, cylinder) ? playerCellColor : failureColor),
});
}
public function testLoveTime_1():Void {
tweenManager.serial([
tweenManager.tween(snakeSmallView)
.onStartSet({ alpha: 0.0, scaleX: 2.0, scaleY: 2.0, offsetY: 0.0, visibility: ViewVisibility.VISIBLE })
.toFloat({ alpha: 1.0, scaleX: 1.0, scaleY: 1.0 })
.duration(1.0)
,
tweenManager.tween(introText1View)
.onStartSet({ alpha: 0.0, offsetY: -32.0, visibility: ViewVisibility.VISIBLE })
.toFloat({ alpha: 1.0, offsetY: 0.0 })
.duration(1.0)
,
tweenManager.wait().onStartRun(function(_) {
TweenUtils.set(backgroundItemList[0].noColorView, { alpha: 1.0, offsetX: 0.0, visibility: ViewVisibility.VISIBLE });
}),
tweenManager.tween(backgroundItemList[0].hasColorView)
.toFloat({ alpha: 0.0 })
.onStopSet({ visibility: ViewVisibility.GONE })
.duration(1.0)
.ease(Ease.linear)
,
tweenManager.parallel([
tweenManager.tween(backgroundItemList[0].noColorView)
.toFloat({ alpha: 0.0, offsetX: -256.0 })
.onStopSet({ visibility: ViewVisibility.GONE })
,
tweenManager.tween(backgroundItemList[1].hasColorView)
.onStartSet({ alpha: 0.0, offsetX: 256.0, visibility: ViewVisibility.VISIBLE })
.toFloat({ alpha: 1.0, offsetX: 0.0 })
,
]).childDuration(2.0).childLag(1.0),
tweenManager.run(function(_) {
TweenUtils.set(backgroundItemList[1].noColorView, { alpha: 1.0, offsetX: 0.0, visibility: ViewVisibility.VISIBLE });
}),
tweenManager.tween(backgroundItemList[1].hasColorView)
.toFloat({ alpha: 0.0 })
.onStopSet({ visibility: ViewVisibility.GONE })
.duration(1.0)
.ease(Ease.linear)
,
tweenManager.parallel([
tweenManager.tween(backgroundItemList[1].noColorView)
.toFloat({ alpha: 0.0, offsetX: -256.0 })
.onStopSet({ visibility: ViewVisibility.GONE })
,
tweenManager.tween(backgroundItemList[2].hasColorView)
.onStartSet({ alpha: 0.0, offsetX: 256.0, visibility: ViewVisibility.VISIBLE })
.toFloat({ alpha: 1.0, offsetX: 0.0 })
,
]).childDuration(2.0).childLag(1.0),
tweenManager.run(function(_) {
TweenUtils.set(backgroundItemList[2].noColorView, { alpha: 1.0, offsetX: 0.0, visibility: ViewVisibility.VISIBLE });
}),
tweenManager.tween(backgroundItemList[2].hasColorView)
.toFloat({ alpha: 0.0 })
.onStopSet({ visibility: ViewVisibility.GONE })
.duration(1.0)
.ease(Ease.linear)
,
tweenManager.parallel([
tweenManager.tween(nextBtn)
.onStartSet({ alpha: 0.0, visibility: ViewVisibility.VISIBLE })
.toFloat({ alpha: 1.0 })
.duration(1.0)
,
tweenManager.run(function(_) {
nextBtn.disabled = false;
}),
]).childLag(0.5),
]);
}
public function testLoveTime_2():Void {
tweenManager.parallel([
tweenManager.tween(nextBtn)
.onStartSet({ disabled: true })
.toFloat({ alpha: 0.0 })
.duration(1.0)
,
tweenManager.serial([
tweenManager.tween(introText1View)
.toFloat({ alpha: 0.0, offsetY: 32.0 })
.onStopSet({ visibility: ViewVisibility.GONE })
.duration(1.0)
,
tweenManager.tween(catSmallView)
.onStartSet({ alpha: 0.0, scaleX: 2.0, scaleY: 2.0, offsetY: 0.0, visibility: ViewVisibility.VISIBLE })
.toFloat({ alpha: 1.0, scaleX: 1.0, scaleY: 1.0 })
.duration(1.0)
,
tweenManager.tween(introText2View)
.onStartSet({ alpha: 0.0, offsetY: -32.0, visibility: ViewVisibility.VISIBLE })
.toFloat({ alpha: 1.0, offsetY: 0.0 })
.duration(1.0)
,
tweenManager.parallel([
tweenManager.tween(nextBtn)
.toFloat({ alpha: 1.0 })
.duration(1.0)
,
tweenManager.run(function(_) {
nextBtn.disabled = false;
}),
]).childLag(0.5),
]),
]);
}
public function testLoveTime_3():Void {
tweenManager.parallel([
tweenManager.tween(nextBtn)
.onStartSet({ disabled: true })
.toFloat({ alpha: 0.0 })
,
tweenManager.serial([
tweenManager.tween(introText2View)
.toFloat({ alpha: 0.0, offsetY: 32.0 })
.onStopSet({ visibility: ViewVisibility.GONE })
.duration(1.0)
,
tweenManager.parallel([
tweenManager.tween(introText3View)
.onStartSet({ alpha: 0.0, offsetY: -32.0, visibility: ViewVisibility.VISIBLE })
.toFloat({ alpha: 1.0, offsetY: 0.0 })
,
tweenManager.tween(nextBtn)
.toFloat({ alpha: 1.0 })
,
tweenManager.run(function(_) {
nextBtn.disabled = false;
}).delay(0.5),
]),
]),
]);
}
public function testLoveTime_4():Void {
tweenManager.serial([
tweenManager.parallel([
tweenManager.tween(nextBtn)
.onStartSet({ disabled: true })
.toFloat({ alpha: 0.0 })
,
tweenManager.tweenMultiple([ snakeSmallView, catSmallView, introText3View ])
.toFloat({ alpha: 0.0, offsetY: 32.0 })
.onStopSet({ visibility: ViewVisibility.GONE })
,
]).childDuration(1.0),
tweenManager.parallel([
tweenManager.tween(vsGroupView)
.onStartSet({ alpha: 0.0, offsetY: -32.0, visibility: ViewVisibility.VISIBLE })
.toFloat({ alpha: 1.0, offsetY: 0.0 })
.duration(1.0)
,
tweenManager.tween(nextBtn)
.toFloat({ alpha: 1.0 })
.duration(1.0)
,
tweenManager.run(function(_) {
nextBtn.disabled = false;
}).delay(0.5),
]),
]);
}
public function testLoveTime_5():Void {
tweenManager.parallel([
testShake(snakeView).onStartRun(function(_) {
soundManager.playSound(soundManager.shakeSound);
}),
testShake(snakeView).onStartRun(function(_) {
soundManager.playSound(soundManager.shakeSound);
}).delay(0.5),
testShake(snakeView).onStartRun(function(_) {
soundManager.playSound(soundManager.shakeSound);
}).delay(1.0),
tweenManager.tween(snakeView)
.onStartRun(function(_) {
soundManager.playSound(soundManager.disappearSound);
})
.toFloat({ alpha: 0.0, scaleX: 0.5, scaleY: 0.5 })
.duration(0.5)
.delay(1.25)
,
tweenManager.serial([
tweenManager.run(function(_) {
TweenUtils.set(backgroundItemList[2].hasColorView, { alpha: 1.0, offsetX: 0.0, visibility: ViewVisibility.VISIBLE });
}),
tweenManager.tween(backgroundItemList[2].noColorView)
.toFloat({ alpha: 0.0 })
.onStopSet({ visibility: ViewVisibility.GONE })
.duration(1.0)
.ease(Ease.linear)
,
tweenManager.parallel([
tweenManager.tween(backgroundItemList[2].hasColorView)
.toFloat({ alpha: 0.0, offsetX: 256.0 })
.onStopSet({ visibility: ViewVisibility.GONE })
,
tweenManager.tween(backgroundItemList[1].noColorView)
.onStartSet({ alpha: 0.0, offsetX: -256.0, visibility: ViewVisibility.VISIBLE })
.toFloat({ alpha: 1.0, offsetX: 0.0 })
,
]).childDuration(2.0).childLag(1.0),
tweenManager.run(function(_) {
TweenUtils.set(backgroundItemList[1].hasColorView, { alpha: 1.0, offsetX: 0.0, visibility: ViewVisibility.VISIBLE });
}),
tweenManager.tween(backgroundItemList[1].noColorView)
.toFloat({ alpha: 0.0 })
.onStopSet({ visibility: ViewVisibility.GONE })
.duration(1.0)
.ease(Ease.linear)
,
tweenManager.parallel([
tweenManager.tween(backgroundItemList[1].hasColorView)
.toFloat({ alpha: 0.0, offsetX: 256.0 })
.onStopSet({ visibility: ViewVisibility.GONE })
,
tweenManager.tween(backgroundItemList[0].noColorView)
.onStartSet({ alpha: 0.0, offsetX: -256.0, visibility: ViewVisibility.VISIBLE })
.toFloat({ alpha: 1.0, offsetX: 0.0 })
,
]).childDuration(2.0).childLag(1.0),
tweenManager.run(function(_) {
TweenUtils.set(backgroundItemList[0].hasColorView, { alpha: 1.0, offsetX: 0.0, visibility: ViewVisibility.VISIBLE });
}),
tweenManager.tween(backgroundItemList[0].noColorView)
.toFloat({ alpha: 0.0 })
.onStopSet({ visibility: ViewVisibility.GONE })
.duration(1.0)
.ease(Ease.linear)
,
tweenManager.parallel([
tweenManager.tween(restartBtn)
.onStartSet({ alpha: 0.0, visibility: ViewVisibility.VISIBLE })
.toFloat({ alpha: 1.0 })
.duration(1.0)
,
tweenManager.tween(resultTextView)
.onStartSet({ alpha: 0.0, offsetY: -50.0, visibility: ViewVisibility.VISIBLE })
.toFloat({ alpha: 1.0, offsetY: 0.0 })
.duration(2.0)
,
]),
]).delay(1.25)
]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment