Sine and Plasma

Post Reply
User avatar
NightRadio
Site Admin
Posts: 2860
Joined: Fri Jan 23, 2004 12:28 am
Location: Ekaterinburg. Russia
Contact:

Sine and Plasma

Post by NightRadio » Sun Sep 30, 2012 10:27 am

Image

Code: Select all

scr = get_screen()
xsize = get_xsize( scr )
ysize = get_ysize( scr )

start_timer( 0 )

palette = new( 256 )
i = 0 while( i < 128 )
{
    v = i
    v * 2
    palette[ i ] = get_color( v / 2, v, v / 4 )
    i + 1
}

i = 128 while( i < 256 )
{
    v = 256 - i
    v * 2
    palette[ i ] = get_color( v * 3, v, v / 6 )
    i + 1
}

scr = get_screen()
img1 = new( get_xsize( scr ), get_ysize( scr ), INT8 )
img2 = clone( img1 )

while( 1 )
{
    t = get_timer( 0 ) / 1000

    clear()
    
    generator( OP_SIN8, img1, t, 128, cos( t / 2 ) / 53, cos( t / 4 ) / 44 )
    generator( OP_SIN8, img2, t / 2, 128, sin( t / 3 ) / 50, sin( t / 3 ) / 48 )
    op_ccn( OP_MUL_DIV, img1, img2, 128 )
    generator( OP_SIN8, img2, t / 3, 128, cos( t / 4 ) / 23, sin( t / 5 ) / 88 )
    op_ccn( OP_MUL_DIV, img1, img2, 128 / 2 )
    replace_values( scr, img1, palette )

    transp( 128 )
    clear()
    transp( 256 )

    y = -64
    x = -xsize/2
    while( x < xsize / 2 )
    {
	transp( 256 )
        tt = t + x / 16
        dot( x, y + sin( tt ) * 32, WHITE )
        v = sin( tt * 1.1 ) * cos( tt / 2 + x / 4 ) * 32
        dot( x, 32 + y + v, WHITE )
        dot( x, 64 + y + ( sin( tt * 3 ) + cos( tt + t ) ) * 16, WHITE )
        dot( x, 128 + y + v, WHITE )
        transp( -v * 4 )
        line( x, 128 + y + v, x, ysize / 2, #FF8040 ) //get_color( 129 - v * 8, v * 5, v * 9 ) )
        x + 1
    }
    
    transp( 256 )
    t_rotate( t * 50, 0, 1, 0 )
    t_scale( 2, 2, 2 )
    print( "Hello Pixi!", 0, 0, WHITE )
    transp( 64 )
    t_scale( 2, 2, 2 )
    print( "Hello Pixi!", 0, 0, WHITE )
    transp( 32 )
    t_scale( 2, 2, 2 )
    print( "Hello Pixi!", 0, 0, WHITE )
    t_reset()    

    while( get_event() ) { if EVT[ EVT_TYPE ] == EVT_QUIT { halt } }

    frame()
}

Post Reply