Code edit (1 edits merged)
Please save this source code
User prompt
add a tint FFF to text
User prompt
add text to game instead of gui
User prompt
fill property has a problem; try something else to make text white
Code edit (9 edits merged)
Please save this source code
User prompt
text appears black, change it to white
Code edit (3 edits merged)
Please save this source code
User prompt
add a text "Easing" in bottom center
User prompt
ok, now instead of logo.x = -logo.width; logo.y = -logo.height; use a rancom corner
User prompt
refoactor the code to reduce duplication
User prompt
at the end of tween(logo, { x: -logo.width, y: -logo.height }, { duration: 2000, easing: randomEasing }); call the easing in code
User prompt
Please fix the code, too laggy
Code edit (1 edits merged)
Please save this source code
User prompt
Here is the desired behaviour : Start : logo is out and enters to the center with elasticIn Tap : logo leaves with a rancom ...Out easing the, comes back with a random "...In" easing
Code edit (1 edits merged)
Please save this source code
Code edit (3 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: easingFunctionsIn is not defined' in or related to this line: 'randomEasing = easingFunctionsIn[Math.floor(Math.random() * easingFunctionsIn.length)];' Line Number: 70
User prompt
when logo is out, automatically call it in witha random "...In" easing (no need to tap again)
User prompt
When tapping, if logo is out animate the logo with a random "...In" easing and if logo is in, animate it gouing out with a random "...out" easing
User prompt
instead of tween.bounceInOut, use a random easing from all available ones
Code edit (1 edits merged)
Please save this source code
User prompt
use Elastic, and replay the anim when screen us tapped
User prompt
try Back easing
User prompt
try Elastic
User prompt
try bounce
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ // Logo class var Logo = Container.expand(function () { var self = Container.call(this); var logoGraphics = self.attachAsset('logo', { anchorX: 0.5, anchorY: 0.5 }); }); /**** * Initialize Game ****/ //<Write entity 'classes' with empty functions for important behavior here> var game = new LK.Game({ backgroundColor: 0x000000 //Init game with black background }); /**** * Game Code ****/ var logoIn = false; // Track the state of the logo (in or out) var easingFunctionsIn = [tween.linear, tween.easeIn, tween.elasticIn, tween.bounceIn]; var easingFunctionsOut = [tween.linear, tween.easeOut, tween.elasticOut, tween.bounceOut]; game.down = function (x, y, obj) { var randomEasing; function animateLogo(isLogoIn) { var randomEasing; if (!isLogoIn) { // If logo is out, animate it in // Randomly select a corner for the logo to appear var corners = [{ x: -logo.width, y: -logo.height }, // Top left { x: 2048 + logo.width, y: -logo.height }, // Top right { x: -logo.width, y: 2732 + logo.height }, // Bottom left { x: 2048 + logo.width, y: 2732 + logo.height } // Bottom right ]; var corner = corners[Math.floor(Math.random() * corners.length)]; logo.x = corner.x; logo.y = corner.y; randomEasing = easingFunctionsIn[Math.floor(Math.random() * easingFunctionsIn.length)]; } else { // If logo is in, animate it out randomEasing = easingFunctionsOut[Math.floor(Math.random() * easingFunctionsOut.length)]; } tween(logo, { x: isLogoIn ? -logo.width : 1024, y: isLogoIn ? -logo.height : 1366 }, { duration: 2000, easing: randomEasing, onFinish: function onFinish() { if (isLogoIn) { animateLogo(false); } } }); logoIn = !isLogoIn; } animateLogo(logoIn); }; var logo = game.addChild(new Logo()); logo.x = -logo.width; logo.y = -logo.height; tween(logo, { x: 1024, y: 1366 }, { duration: 2000, easing: tween.elasticIn }); // Add a text 'Easing' in bottom center var easingText = new Text2('Easing', { size: 150, fill: 0xFFFFFF }); easingText.anchor.set(0.5, 1); // Sets anchor to the center of the bottom edge of the text. LK.gui.bottom.addChild(easingText);
===================================================================
--- original.js
+++ change.js
@@ -88,5 +88,12 @@
y: 1366
}, {
duration: 2000,
easing: tween.elasticIn
-});
\ No newline at end of file
+});
+// Add a text 'Easing' in bottom center
+var easingText = new Text2('Easing', {
+ size: 150,
+ fill: 0xFFFFFF
+});
+easingText.anchor.set(0.5, 1); // Sets anchor to the center of the bottom edge of the text.
+LK.gui.bottom.addChild(easingText);
\ No newline at end of file