Omnimaga

Calculator Community => Other Calc-Related Projects and Ideas => Topic started by: Munchor on October 29, 2010, 02:45:50 pm

Title: Animations
Post by: Munchor on October 29, 2010, 02:45:50 pm
I've been playing around with animations and I've done a few interesting things, for now, I'll post a simple animation.

I've made a few more complex and fun, but can't upload them at the moment.

The GIF made in WabbitEmu doesn't look very fast, but it is fast and optimized, is there any trick to save faster GIFs?

Close all problems? Change settings?

Thanks, please tell me what you think. I think these could be used somewhere in a program, but anyways it's for practice mostly.
Title: Re: Animations
Post by: MRide on October 29, 2010, 02:55:47 pm
Looks cool! Is it supposed to move up and down or just side to side?
Title: Re: Animations
Post by: Munchor on October 29, 2010, 03:12:05 pm
Looks cool! Is it supposed to move up and down or just side to side?

It gives the idea it is moving down, but it isn't, check why:

Code: [Select]
:ClrHome
:For(A,1,100
:Disp ".
:Disp " .
:Disp "  .
:Disp "   .
:Disp "    .
:Disp "     .
:Disp "      .
:Disp "       .
:Disp "        .
:Disp "         .
:Disp "        .
:Disp "       .
:Disp "      .
:Disp "     .
:Disp "    .
:Disp "   .
:Disp "  .
:Disp " .
:End
Title: Re: Animations
Post by: MRide on October 29, 2010, 03:13:20 pm
Well, I mean, when it moves to the left, it drops down a sprite.  Is that intentional? 
Title: Re: Animations
Post by: Munchor on October 29, 2010, 03:16:23 pm
Well, I mean, when it moves to the left, it drops down a sprite.  Is that intentional? 

Does it?

There are two:
Code: [Select]
:Disp ".
:Disp ".

That is intentional, is that what you mean?
Title: Re: Animations
Post by: MRide on October 29, 2010, 03:18:26 pm
Ah, yeah, that's just because of Disp.
Nice effect.  It's not easy to get good animations in BASIC.
Title: Re: Animations
Post by: Deep Toaster on October 29, 2010, 03:31:59 pm
The GIF made in WabbitEmu doesn't look very fast, but it is fast and optimized, is there any trick to save faster GIFs?

Close all problems? Change settings?

Yep, just change the Framerate setting to 9 or something. That way, it'll look better in certain browsers.
Title: Re: Animations
Post by: Munchor on October 29, 2010, 03:47:20 pm
A wave animation, I'll do a sea wave animation right away hahah.

Then, I'm gonna do a virus-like animation, which will be quite hard.

How can I do something like this:

Output(1,1,".

Then, wait a second or two and

Output(1,2,".

A second or two and

Output(1,3,".

Have no idea, th0ugh. Thanks :)
Title: Re: Animations
Post by: squidgetx on October 29, 2010, 03:53:03 pm
Put a For(A,0, somenumber): End where you want to pause. For 1 or two seconds I think try like 100 or 200 for somenumber (I forget exactly)
Title: Re: Animations
Post by: JosJuice on October 29, 2010, 03:53:29 pm
How can I do something like this:

Output(1,1,".

Then, wait a second or two and

Output(1,2,".

A second or two and

Output(1,3,".
If you want to make the program wait a bit, use something like rand(100 to waste processing time.
Title: Re: Animations
Post by: ztrumpet on October 29, 2010, 03:56:38 pm
It gives the idea it is moving down, but it isn't, check why:

Code: [Select]
:ClrHome
:For(A,1,100
:Disp ".
:Disp " .
:Disp "  .
:Disp "   .
:Disp "    .
:Disp "     .
:Disp "      .
:Disp "       .
:Disp "        .
:Disp "         .
:Disp "        .
:Disp "       .
:Disp "      .
:Disp "     .
:Disp "    .
:Disp "   .
:Disp "  .
:Disp " .
:End
Nice effect. :)

Here's my code for the same effect:
Code: [Select]
:ClrHome
:For(A,1,7
:Disp " // Nothing after the quote
:End
:1->A // Current X position
:1->B // Variable to track movement
:Repeat getKey
:Disp " // Again, nothing after the quote
:Output(8,A,".
:A+B->A
:If Ans=10 or Ans=1
:-B->B // That's the negative sign, not minus
:End

What do you think of my code? :)

Nice animation; great job for just starting basic! ;D
Title: Re: Animations
Post by: Munchor on October 29, 2010, 03:59:25 pm
That gave me a syntax error, though, can't tell which line for now, WabbitEmu.
Title: Re: Animations
Post by: ztrumpet on October 29, 2010, 04:00:58 pm
Hmm, I just typed it to makes sure it would work.  Did you type the "//" and everything after them?  Those are comments and they're not meant to be typed in the code. :)
Title: Re: Animations
Post by: squidgetx on October 29, 2010, 04:01:28 pm
Don't type in the // and the stuff after it; those are his comments

...ninja'd
Title: Re: Animations
Post by: Munchor on October 29, 2010, 04:02:08 pm
Hmm, I just typed it to makes sure it would work.  Did you type the "//" and everything after them?  Those are comments and they're not meant to be typed in the code. :)

Of course I removed the //, I'm not that stupid :S
Title: Re: Animations
Post by: ztrumpet on October 29, 2010, 04:11:12 pm
A wave animation, I'll do a sea wave animation right away hahah.
My code for that one:
Code: [Select]
:ClrHome
:For(A,1,7
:Disp " // Nothing after the quote
:End
:DelVar A1->B // A is Current X location, B is Variable to track movement
:Repeat getKey
:Disp " // Again, nothing after the quote
:Output(8,1,sub("..........         ",10-A,10  // 10 periods followed by 9 spaces
:A+B->A
:If Ans=9 or not(Ans
:-B->B // That's the negative sign, not minus
:End
Title: Re: Animations
Post by: yunhua98 on October 29, 2010, 04:36:11 pm
try this if the one ztrumpet posted doesn't work:

Code: [Select]
:Clrhome
:For(A,1,8
:Disp "
:End
:"(7 spaces).(7 spaces)->Str1
:Delvar TWhile 1
:T+1->T
:Disp sub(Str1,T,8
:If T=8
:Delvar T
:End

the Delvar stuff is intentional.  ;)
Title: Re: Animations
Post by: ztrumpet on October 29, 2010, 05:32:03 pm
Did you try to test your yunhua? :)

If T does not equal 8, it will skip the End. :(
Also, T+->T doesn't quite work either. :(
Title: Re: Animations
Post by: yunhua98 on October 29, 2010, 05:34:26 pm
oops.  :-[  fixing.  :P

done.  ;)
Title: Re: Animations
Post by: Munchor on October 29, 2010, 05:35:30 pm
I prefer to do:

T + 1 -> T

:)
Title: Re: Animations
Post by: yunhua98 on October 29, 2010, 05:37:11 pm
yeah, that was a mistake.  :P
Title: Re: Animations
Post by: DJ Omnimaga on October 29, 2010, 05:38:02 pm
See prgmI13A included with Illusiat 13 game. It contains 54 magic animations in under 2 KB BASIC code. I don't exactly remember which variable need to be initialized before running it, though. You may have to check prgmI13C too. I would post the code but SourceCoder messes it up extremly bad...
Title: Re: Animations
Post by: Munchor on October 29, 2010, 05:44:22 pm
I made a virus effect image, the only way to shut the program is by clicking "On", is there a way to change this?

Thanks ^^
Title: Re: Animations
Post by: yunhua98 on October 29, 2010, 05:45:39 pm
you can use Onblock, an Assembly program which blocks the On button.  btw, I see you got Wabbit working.  :D

EDIT: link
http://www.ticalc.org/archives/files/fileinfo/330/33039.html
Title: Re: Animations
Post by: meishe91 on October 29, 2010, 06:28:29 pm
Huh, interesting. I had programs that did the wave effects, though when I went back and looked at them they were not optimized at all :P (made when I was just getting back into programing and such :P).

With Pure TI-BASIC, no, unfortunately you can't disable the [ON] break but with Hybrid TI-BASIC and, or as yunhua98 said, assembly you can.
Title: Re: Animations
Post by: Deep Toaster on October 29, 2010, 07:31:25 pm
That gave me a syntax error, though, can't tell which line for now, WabbitEmu.

What line did it point to?
Title: Re: Animations
Post by: meishe91 on October 29, 2010, 07:51:48 pm
A wave animation, I'll do a sea wave animation right away hahah.
My code for that one:
Code: [Select]
:ClrHome
:For(A,1,7
:Disp " // Nothing after the quote
:End
:DelVar A1->B // A is Current X location, B is Variable to track movement
:Repeat getKey
:Disp " // Again, nothing after the quote
:Output(8,1,sub("..........         ",10-A,10  // 10 periods followed by 9 spaces
:A+B->A
:If Ans=9 or not(Ans
:-B->B // That's the negative sign, not minus
:End

You can actually shave off ten bytes by having this:

Code: [Select]
For(A,1,7
Disp "
End
1→A
Ans→B
Repeat getKey
Disp "
Output(8,1,sub("..........",1,A
A+B→A
If max(Ans={1,10
-B→B
End

The reason it works is because Disp works the same as pushing [ENTER] on the homescreen. If you enter a string it will display it on the left side but if it's a number it will display on the right. Therefore, there is no need to accommodate :)
Title: Re: Animations
Post by: ztrumpet on October 29, 2010, 10:59:49 pm
Wow, I can't believe I did it the way I did.  Thanks for pointing it out! ;D  * ZTrumpet feeds himself to the lobster. ^-^
Title: Re: Animations
Post by: meishe91 on October 29, 2010, 11:11:56 pm
No problem :) Simple mistake to make though so no worries :)
Title: Re: Animations
Post by: Munchor on October 30, 2010, 04:59:10 am
Ok, I made it working, I did (-B) -> B, and it worked :)

Yeah it is faster, but I could never do something like that :(

Code: [Select]
:ClrHome
:For(A,1,500
:Output(1,1,"DELETING RAM
:2→A
:Output(A,1,".
:rand(15
:Output(A,2,".
:rand(15
:Output(A,3,".
:rand(15
:Output(A,4,".
:rand(15
:Output(A,5,".
:rand(15
:Output(A,6,".
:rand(15
:Output(A,7,".
:rand(15
:Output(A,8,".
:rand(15
:Output(A,9,".
:rand(15
:Output(A,10,".
:rand(15
:Output(A,11,".
:rand(15
:Output(A,12,".
:rand(15
:Output(A,13,".
:rand(15
:Output(A,14,".
:rand(15
:Output(A,15,".
:rand(15
:Output(A,16,".
:rand(15
:Output(3,1,"RAM DELETED
:A+2→A
:Output(A,1,".
:rand(15
:Output(A,2,".
:rand(15
:Output(A,3,".
:rand(15
:Output(A,4,".
:rand(15
:Output(A,5,".
:rand(15
:Output(A,6,".
:rand(15
:Output(A,7,".
:rand(15
:Output(A,8,".
:rand(15
:Output(A,9,".
:rand(15
:Output(A,10,".
:rand(15
:Output(A,11,".
:rand(15
:Output(A,12,".
:rand(15
:Output(A,13,".
:rand(15
:Output(A,14,".
:rand(15
:Output(A,15,".
:rand(15
:Output(A,16,".
:rand(15
:Output(5,1,"DESTROYING
:A+2→A
:Output(A,1,".
:rand(15
:Output(A,2,".
:rand(15
:Output(A,3,".
:rand(15
:Output(A,4,".
:rand(15
:Output(A,5,".
:rand(15
:Output(A,6,".
:rand(15
:Output(A,7,".
:rand(15
:Output(A,8,".
:rand(15
:Output(A,9,".
:rand(15
:Output(A,10,".
:rand(15
:Output(A,11,".
:rand(15
:Output(A,12,".
:rand(15
:Output(A,13,".
:rand(15
:Output(A,14,".
:rand(15
:Output(A,15,".
:rand(15
:Output(A,16,".
:rand(15
:Output(7,1,"VIRUS FINISH
:A+2→A
:Output(A,1,".
:rand(15
:Output(A,2,".
:rand(15
:Output(A,3,".
:rand(15
:Output(A,4,".
:rand(15
:Output(A,5,".
:rand(15
:Output(A,6,".
:rand(15
:Output(A,7,".
:rand(15
:Output(A,8,".
:rand(15
:Output(A,9,".
:rand(15
:Output(A,10,".
:rand(15
:Output(A,11,".
:rand(15
:Output(A,12,".
:rand(15
:Output(A,13,".
:rand(15
:Output(A,14,".
:rand(15
:Output(A,15,".
:rand(15
:Output(A,16,".
:rand(15
:End
Title: Re: Animations
Post by: JosJuice on October 30, 2010, 08:33:49 am
What is the purpose of your for loop? Since you're using 2→A at the start of the loop, A will have the same value every time the loop is run, and the only thing that will happen when you run the loop more than once is that the what you've already drawn will be drawn on top on itself.

The code can also be rewritten to save space by using other for loops.

Code: [Select]
:ClrHome
:Output(1,1,"DELETING RAM
:For(A,1,16
:Output(2,A,".
:rand(15
:End
:Output(3,1,"RAM DELETED
:For(A,1,16
:Output(4,A,".
:rand(15
:End
:Output(5,1,"DESTROYING
:For(A,1,16
:Output(6,A,".
:rand(15
:End
:Output(7,1,"VIRUS FINISH
:For(A,1,16
:Output(8,A,".
:rand(15
:End

Or even like this:

Code: [Select]
:ClrHome
:For(B,2,8,2
:If B=2
:Output(1,1,"DELETING RAM
:If B=4
:Output(3,1,"RAM DELETED
:If B=6
:Output(5,1,"DESTROYING
:If B=8
:Output(7,1,"VIRUS FINISH
:For(A,1,16
:Output(B,A,".
:rand(15
:End
:End
Title: Re: Animations
Post by: MRide on October 30, 2010, 09:46:12 am
The Virus program is interesting.  Maybe you could have it display the "Mem Cleared" screen at the end.