Thread: Bending Gfx
View Single Post
  #13  
Old 04-30-2006, 11:37 PM
ZeLpH_MyStiK ZeLpH_MyStiK is offline
Scripter
ZeLpH_MyStiK's Avatar
Join Date: May 2003
Location: NYC
Posts: 553
ZeLpH_MyStiK is on a distinguished road
Send a message via MSN to ZeLpH_MyStiK Send a message via Yahoo to ZeLpH_MyStiK
Edit: Didn't see this in the GS2 forums, so the script is in GS1. But it can be easily converted using the same idea.

Alright, this is an extremely poor method of creating this illusion, but I created a simple script in demonstrating it. There could be errors as I made this in about 5 minutes, but here goes anyways:
PHP Code:
//#CLIENTSIDE
if (created) {
  
this.offset_x 1;  // offsets the image 16 pixels to the right so the mouse doesn't block it
  
this.offset_y 1;  // offsets 16 pixels down for the same reason
  
this.width imgwidth(block.png);  // the width of the image i'm using block.png
  
setarray this.offset_z,this.width;  // controls the z-coor of each row of pixels
  
setarray this.offset_zmode,this.width;  // controls whether the z-coors should go up or down
  
for(this.i=0this.i<32this.i++) this.offset_z[this.i] = this.i;  // sets the starting positions
  
timeout .05;  // begins the timeout for showimgs
}
if (
timeout) {
  for(
this.i=0this.i<32this.i++) {  // loops thru each pixel row of the image
    
for(this.j=0this.j<32this.j++) {  // loops thru the pixel columns
      
showimg2 200 this.32 this.j,block.png,this.offset_x mousex this.16,this.offset_y mousey this.16,this.offset_z[this.i] / 16;  // shows every pixels of the image at its original location with the exception of the z-coors which are decided by the arrays
      
changeimgpart 200 this.32 this.j,this.i,this.j,1,1;  // shows a pixel as opposed to the entire image
    
}
  }
  for(
this.i=0this.i<32this.i++) {
    if (
this.offset_zmode[this.i] == 0) {  // if the pixel is moving upwards
      
if (this.offset_z[this.i] + == 32) {  // if the pixel reaches the top
        
this.offset_zmode[this.i] = 1;  // changes mode
      
}else this.offset_z[this.i]++;  // otherwise continue upwards movement
    
}else{  // if the pixels are moving downwards
      
if (this.offset_z[this.i] - == 16) {  // as the pixels reach halfway down
        
this.offset_zmode[this.i] = 0;  // change modes
      
}else this.offset_z[this.i]--;  // otherwise continue downwards movement
    
}
  }
  
timeout .05;  // continues loop

Once again very poor method. Also this will lag with giant images.
__________________
Reply With Quote