Author Topic: Hypnotic animation  (Read 1520 times)

Galileo

  • Guest
Hypnotic animation
« on: May 02, 2017, 06:52:55 PM »
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.html

caleiLength = 200
width = 400 : height = 400
x = 1 : y = 2 : t = 3 : speed = 4

dim calei(caleiLength,4)

open window width, height
backcolor 150,0,0

for 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/1000
next i

do
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 i
loop
« Last Edit: May 03, 2017, 03:33:47 PM by Galileo »

ZXDunny

  • Guest
Re: Hypnotic animation
« Reply #1 on: May 03, 2017, 11:00:39 AM »
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:cls
20 for i=0 to cl:
    c(i,x)=scrw/2+cos(i/2)*i,
    c(i,y)=scrh/2+sin(i/2)*i:
 next i
30 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+

  • Guest
Re: Hypnotic animation
« Reply #2 on: May 03, 2017, 06:50:57 PM »
Well I've shown mine  ;D

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

Do you have any comments about it?


Galileo

  • Guest
Re: Hypnotic animation
« Reply #3 on: May 04, 2017, 07:05:16 PM »
Well I've shown mine  ;D

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

Do you have any comments about it?



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

B+

  • Guest
Re: Hypnotic animation
« Reply #4 on: May 04, 2017, 08:29:04 PM »
OK, Thanks, for code posts!