### Author Topic: Hypnotic animation  (Read 276 times)

#### Galileo

• Jr. Member
• Posts: 77
##### Hypnotic animation
« on: 02. May 2017, 20:52:55 »
Code: [Select]
`// Yabasic 2.78.0, 5/2017// Adapted by Galileo from this code: https://www.funprogramming.org/113-Array-of-objects-hypnotic-animation-part-II.htmlcaleiLength = 200width = 400 : height = 400x = 1 : y = 2 : t = 3 : speed = 4dim calei(caleiLength,4)open window width, heightbackcolor 150,0,0for i=0 to caleiLength calei(i,x) = width/2 + cos(i/2) * i calei(i,y) = height/2 + sin(i/2) * i calei(i,speed) = 0.05 + i/1000next ido pause .02 clear window for i = 0 to caleiLength switch int(mod(abs(sin(calei(i,t))),4)*4) case 0: sz = 0 : break case 1: sz = 1 : break case 2: sz = 2 : break case 3: sz = 4 : break end switch col = mod(calei(i,t),255) color col,col,col fill circle calei(i,x),calei(i,y),sz calei(i,t) = calei(i,t)+calei(i,speed) next iloop`
« Last Edit: 03. May 2017, 17:33:47 by Galileo »

#### ZXDunny

• Full Member
• Posts: 145
##### Re: Hypnotic animation
« Reply #1 on: 03. May 2017, 13:00:39 »
Here's mine in SpecBAS:

Code: [Select]
`10 cl=450: const x=0,y=1,clr=2,r=3,t=4,s=5: dim c(cl+1,6) base 0: palette 2,150,0,0: paper 2:cls20 for i=0 to cl:    c(i,x)=scrw/2+cos(i/2)*i,    c(i,y)=scrh/2+sin(i/2)*i: next i30 do:    cls:    for i=0 to cl:       c(i,r)=1 shl (abs sin c(i,t)*4):       c(i,t)+=.05+i/1000:    next i:    plot c():    WAIT SCREEN: loop`
Same effect, but I didn't bother with the greyscale colouring as pure black looks better, IMO.

#### B+

• Sr. Member
• Posts: 498
##### Re: Hypnotic animation
« Reply #2 on: 03. May 2017, 20:50:57 »
Well I've shown mine

Galileo, that is an interesting site in your code. I took a quick glimpse.

#### Galileo

• Jr. Member
• Posts: 77
##### Re: Hypnotic animation
« Reply #3 on: 04. May 2017, 21:05:16 »
Well I've shown mine

Galileo, that is an interesting site in your code. I took a quick glimpse.

I'm sorry I do not participate in the conversations anymore, but I do not speak English (I use Google translator).

#### B+

• Sr. Member
• Posts: 498
##### Re: Hypnotic animation
« Reply #4 on: 04. May 2017, 22:29:04 »
OK, Thanks, for code posts!