From 8bbf710a5cd34412216722a5ed15417ebbefbaa6 Mon Sep 17 00:00:00 2001 From: John Alanbrook Date: Tue, 6 Jun 2023 13:07:18 +0000 Subject: [PATCH] tweening --- startmenu.js | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/startmenu.js b/startmenu.js index e06972d..746bdd5 100644 --- a/startmenu.js +++ b/startmenu.js @@ -1,9 +1,9 @@ var startgame = function() { - run("breakout.js"); - options.tt.stop(); - Player.players[0].uncontrol(startcontroller); - unregister_gui(startmenu); + run("breakout.js"); + options.tt.stop(); + Player.players[0].uncontrol(startcontroller); + unregister_gui(startmenu); }; var exitgame = function() @@ -11,7 +11,6 @@ var exitgame = function() quit(); }; - var colorshifter = { color: Color.green, font_size: 1, @@ -30,14 +29,36 @@ var options = GUI.column({ hovered: {}, }); -options.tt = Tween.start(options, 'hovered', colorshifter, colorshiftend, {time: 0.25, loop: "yoyo", ease: Ease.sine.out}); +options.tt = Tween.start(options, 'hovered', [colorshifter, colorshiftend], {time: 0.35, loop: "restart", whole: false, ease: Ease.quint.out}); + +var rainbowchain = [ + [255,0,0,255], + [255,255,0,255], + [0,255,0,255], + [0,255,255,255], + [0,0,255,255], + [255,0,255,255], +]; + +//Tween.start(options.hovered, 'color', rainbowchain, {time: 4, loop: "circle", whole: true}); var idx = 0; var item = options.items[idx]; item.selected = true; +var menuopts = { + superpos: [0,0], +}; + +Tween.start(menuopts, 'superpos', [Window.dimensions.scale([0.4,0.9]), Window.dimensions.scale([0.6,0.9])], { + time: 1, + loop: "circle", + whole: false, + ease: Ease.cubic.inout +}); + function startmenu() { - GUI.text_fn("SUPER BREAKOUT", {font_size:6, anchor: [0.5,0.5]}).draw(Window.dimensions.scale([0.5,0.9])); + GUI.text_fn("SUPER BREAKOUT", {font_size:6, anchor: [0.5,0.5]}).draw(menuopts.superpos); options.draw(Window.dimensions.scale([0.5,0.5]).add([-25,0]));