User prompt
rename randomEasing
Code edit (3 edits merged)
Please save this source code
User prompt
update corners so the logo stays with screen boundaries
User prompt
fix x: isLogoIn ? -logo.width : 1024, y: isLogoIn ? -logo.height : 1366 to stay in screen boundaries
Code edit (1 edits merged)
Please save this source code
User prompt
in ` tween(logo, { x: isLogoIn ? logo.width / 2 : 1024, y: isLogoIn ? logo.height / 2 : 1366 } ` use a random corner
User prompt
in ` tween(logo, { x: isLogoIn ? logo.width / 2 : 1024, y: isLogoIn ? logo.height / 2 : 1366 } ` use a random corner instead of logo.width / 2, logo.height / 2
User prompt
in corners change 50 offset to 20
Code edit (2 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: corner is undefined' in or related to this line: 'corner.x = logo.x;' Line Number: 78
Code edit (7 edits merged)
Please save this source code
User prompt
Ok. clean the code
User prompt
restore the first logo entrance code : ``` tween(logo, { x: 1024, y: 1366 }, { duration: 2000, easing: tween.elasticIn, onFinish: function onFinish() { isMoving = false; // Set the flag to false when the logo stops moving logoIn = true; } }); ```
Code edit (3 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
===================================================================
--- original.js
+++ change.js
@@ -64,22 +64,24 @@
//easingText.setText(logoIn ? easingFunctionsInNames[easingIndex % easingFunctionsIn.length] : easingFunctionsOutNames[easingIndex % easingFunctionsOut.length]);
};
function animateLogo(isLogoIn) {
isMoving = true; // Set the flag to true when the logo starts moving
+ var corner;
if (!isLogoIn) {
// If logo is out, animate it in
- // Randomly select a corner for the logo to appear
- var corner = corners[Math.floor(Math.random() * corners.length)];
- logo.x = corner.x;
- logo.y = corner.y;
selectedEasing = easingFunctionsIn[easingIndex % easingFunctionsIn.length];
easingText.setText(easingFunctionsInNames[easingIndex % easingFunctionsIn.length]);
+ corner.x = logo.x;
+ corner.y = logo.y;
} else {
// If logo is in, animate it out
selectedEasing = easingFunctionsOut[easingIndex % easingFunctionsOut.length];
easingText.setText(easingFunctionsOutNames[easingIndex % easingFunctionsOut.length]);
+ // Randomly select a corner for the logo to appear
+ corner = corners[Math.floor(Math.random() * corners.length)];
+ logo.x = corner.x;
+ logo.y = corner.y;
}
- var corner = corners[Math.floor(Math.random() * corners.length)];
tween(logo, {
x: isLogoIn ? corner.x : 1024,
y: isLogoIn ? corner.y : 1366
}, {
@@ -99,9 +101,13 @@
x: 1024,
y: 1366
}, {
duration: 2000,
- easing: tween.elasticIn
+ easing: tween.elasticIn,
+ onFinish: function onFinish() {
+ isMoving = false; // Set the flag to false when the logo stops moving
+ logoIn = true;
+ }
});
// Add a text 'Easing' in bottom center
var easingText = new Text2('Easing', {
size: 150,