VideoHelp Forum




+ Reply to Thread
Results 1 to 6 of 6
  1. I saw a jagabo answer about rotating an image with avisynth long time ago, it was something like this:

    Code:
    function MyRotate(clip c, float angle)
    {
        c.Rotate(angle)
        Subtitle(string(angle))
    }
    
    ImageSource("tiny.png", start=0, end=360, fps=60.0) 
    ConvertToRGB32()
    Animate(0, 360, "MyRotate", last,0, last,360)
    I'm trying to learn this but I'm failing miserably, I'm trying to create this effect:



    Rotate each circle in a different direction and speed in a loop, however, I can't even make the transparency work right, If I try a single image it rotates just fine but with a big white square in the background even though the png has transparency:

    Code:
    function MyRotate(clip c, float angle)
    {
        c.Rotate(angle)
    }
    ImageSource("circle1.png", start=0, end=360, fps=60.0)
    ConvertToRGB32()
    Animate(0, 360, "MyRotate", last,0, last,360)

    This is my failing attempt:

    Code:
    function MyRotate(clip c, float angle)
    {
        c.Rotate(angle)
    }
    c3=ImageSource("circle3.png", start=0, end=360, fps=60.0)
    c2=ImageSource("circle2.png", start=360, end=0, fps=30.0)
    c1=ImageSource("circle1.png", start=0, end=360, fps=15.0)
    Overlay(c1+c2+c3, mode="blend", opacity=1)
    Could some one give me some light on this?
    Thanks.
    Image Attached Images      
    Last edited by pokoloko; 8th Aug 2023 at 16:52.
    Quote Quote  
  2. Fine tune to your liking:

    Code:
    function MyRotate(clip c, float angle)
    {
        c.Rotate(angle)
    }
    
    c1=ImageSource("circle1.png", start=0, end=360, fps=60.0, pixel_type="RGB32")
    c2=ImageSource("circle2.png", start=0, end=360, fps=60.0, pixel_type="RGB32")
    c3=ImageSource("circle3.png", start=0, end=360, fps=60.0, pixel_type="RGB32")
    
    
    c1 = Animate(0, 360, "MyRotate", c1,0,  c1,360)
    c2 = Animate(0, 360, "MyRotate", c2,0,  c2,-360)
    c3 = Animate(0, 360, "MyRotate", c3,0,  c3,180)
    
    BlankClip(c1, color=color_white)
    Overlay(last, c1, mask=c1.ShowAlpha)
    Overlay(last, c2, x=(last.width-c2.width)/2, y=(last.height-c2.height)/2, mask=c2.ShowAlpha)
    Overlay(last, c3, x=(last.width-c3.width)/2, y=(last.height-c3.height)/2, mask=c3.ShowAlpha)
    
    # you can leave these out if you can use RGB32 output
    Crop(0,0,-1,-1) # odd frame width not compliant with YV12
    ConvertToYV12() # for x264 encoding
    Image Attached Files
    Quote Quote  
  3. Thank you very much jagabo!
    Quote Quote  
  4. I did this change so 'circle3' complete the 360 rotation:

    Code:
    function MyRotate(clip c, float angle)
    {
        c.Rotate(angle)
    }
    
    c1=ImageSource("circle1.png", start=0, end=360, fps=60.0, pixel_type="RGB32")
    c2=ImageSource("circle2.png", start=0, end=360, fps=60.0, pixel_type="RGB32")
    c3=ImageSource("circle3.png", start=0, end=360, fps=60.0, pixel_type="RGB32")
    
    
    c1 = Animate(0, 360, "MyRotate", c1,0,  c1,360)
    c2 = Animate(0, 360, "MyRotate", c2,0,  c2,-360)
    c3 = Animate(0, 360, "MyRotate", c3,0,  c3,180*4) # or c3,360*2
    
    BlankClip(c1, color=color_white)
    Overlay(last, c1, mask=c1.ShowAlpha)
    Overlay(last, c2, x=(last.width-c2.width)/2, y=(last.height-c2.height)/2, mask=c2.ShowAlpha)
    Overlay(last, c3, x=(last.width-c3.width)/2, y=(last.height-c3.height)/2, mask=c3.ShowAlpha)
    
    # add loop
    #loop()
    
    # you can leave these out if you can use RGB32 output
    Crop(0,0,-1,-1) # odd frame width not compliant with YV12
    ConvertToYV12() # for x264 encoding
    Thank you jagabo.
    Image Attached Files
    Quote Quote  
  5. By the way, if you want a seamless sequence, trim away the last frame (which is a duplicate of the first frame).
    Quote Quote  
  6. Originally Posted by jagabo View Post
    By the way, if you want a seamless sequence, trim away the last frame (which is a duplicate of the first frame).
    Yes, now it runs perfectly.

    Thank you!

    Code:
    function MyRotate(clip c, float angle)
    {
        c.Rotate(angle)
    }
    
    c1=ImageSource("circle1.png", start=0, end=360, fps=60.0, pixel_type="RGB32")
    c2=ImageSource("circle2.png", start=0, end=360, fps=60.0, pixel_type="RGB32")
    c3=ImageSource("circle3.png", start=0, end=360, fps=60.0, pixel_type="RGB32")
    
    
    c1 = Animate(0, 360, "MyRotate", c1,0,  c1,360)
    c2 = Animate(0, 360, "MyRotate", c2,0,  c2,-360)
    c3 = Animate(0, 360, "MyRotate", c3,0,  c3,180*4) # or c3,360*2
    
    BlankClip(c1, color=color_white)
    Overlay(last, c1, mask=c1.ShowAlpha)
    Overlay(last, c2, x=(last.width-c2.width)/2, y=(last.height-c2.height)/2, mask=c2.ShowAlpha)
    Overlay(last, c3, x=(last.width-c3.width)/2, y=(last.height-c3.height)/2, mask=c3.ShowAlpha)
    
    # for a a seamless sequence
    Trim(0,359)
    
    # add loop
    #loop()
    
    # you can leave these out if you can use RGB32 output
    Crop(0,0,-1,-1) # odd frame width not compliant with YV12
    ConvertToYV12() # for x264 encoding
    Image Attached Files
    Last edited by pokoloko; 8th Aug 2023 at 18:45.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!