Jump to content
GreenSock

rondog

BusinessGreen
  • Posts

    16
  • Joined

  • Last visited

Posts posted by rondog

  1. Sorry Carl and Jack, I know you guys said you like to keep the questions on topic with the API, but I feel this is. I am applying filters to a bitmap using something like: 

    TweenLite.to(origBitmap,0,{colorMatrixFilter:{saturation:2,brightness:3});

     and that works fine.

     

    I need to somehow apply a sharpen filter to the video which I have successfully achieved using a ConvolutionFilter. The problem is after I've ran the above tweenlite call, then create a convolution filter and apply it to origBitmap, it removes the initial saturation and brightness filters and just keeps the sharpen filter

    private function applyEffects(effects:Array):void
    {
      currentEffects = effects;
      var props:Object = {};
      for (var i:String in effects)
      {
        props[effects[i].effect] = effects[i].amount;
      }
      TweenLite.to(bitmap,0,{colorMatrixFilter:props});
      //-- props could look like {saturation:2,brightness:3}
    
    
      //-- This will sharpen the container sprite
      var matrix:Array = [0, -1,  0,
                         -1,  5, -1,
                          0, -1,  0];
      var conv:ConvolutionFilter = new ConvolutionFilter();
      conv.matrixX = 3;
      conv.matrixY = 3;
      conv.matrix = matrix;
      conv.divisor = 1; 
      bitmap.filters = [conv]; //-- this removes the above filters and just sharpens the image
    }

    Is there a way to also incorporate the ConvolutionFilter in that TweenLite call above? I've searched quite a bit and found some guy made a class called TweenMan which was based around your class where ConvolutionFilter is incorporated: https://github.com/danro/tweenman-as3

  2. Thanks for the suggestion Jack. I tried doing what you said, but it still did not work. I thought more about your suggestion and came up with a working solution!

     

    var graphicsData:Vector.<IGraphicsData>;
    graphicsData  = container.graphics.readGraphicsData(); 
    var origBitmap:Bitmap = new Bitmap(); 
    origBitmap.bitmapData = GraphicsBitmapFill(graphicsData[0]).bitmapData;
    
    
    //-- at this point I have a screenshot of the video
    
    
    var props:Object = {};
    for (var i:String in currentEffects)
    {
      props[currentEffects[i].effect] = currentEffects[i].amount;
    }
    TweenLite.to(origBitmap,0,{colorMatrixFilter:props});
    
    
    //-- at this point I've reapplied the effects.
    //-- originally, sending bitmap.bitmapData to the encoder didn't retain the filters so I went 1 step further
    
    
    //-- create a new bitmapData and draw the reapplied filter'd bitmap
    var filteredBitmapData:BitmapData = new BitmapData(640,360);
    var filteredBitmap:Bitmap = new Bitmap(filteredBitmapData);
    filteredBitmapData.draw(origBitmap);
    
    
    //-- encode the new bitmap data
    var image:ByteArray = new JPGEncoder(85).encode(filteredBitmapData); //-- filteredBitmapData is now filtered and I can send this to the server
    • Like 2
  3. I have an RTMP stream that I need to take a screenshot of. I got a security error using bitmapData.draw() since it was coming from AWS S3 so I found a workaround that allows me to take a screenshot of the video:
    var bitmap = new Bitmap(); 
    var graphicsData : Vector.<IGraphicsData>;
    graphicsData = container.graphics.readGraphicsData(); //-- container is a sprite that holds my video element 
    bitmap.bitmapData = GraphicsBitmapFill(graphicsData[0]).bitmapData;
    var image:ByteArray = new JPGEncoder(85).encode(bitmap.bitmapData);

    At this point, I send the ByteArray to PHP, create a JPG out of the ByteArray and save it to the server. That all works great.

     
    The issue is I apply filters real-time to the container sprite which alters the look of the video like brightness, contrast, saturation etc, but when saving to the server, the saved image doesn't contain the filters I had applied.
     
    I tried reapplying the filters to bitmap, graphicsData and bitmap.bitmapData before sending it to the server, but nothing has worked yet.
     
    How can I either retain the filters applied or re-apply the filters to the above code?
     
    Here is how I initially apply the filters:
    private function applyEffects(effects:Array):void
    {
      currentEffects = effects;
      var props:Object = {};
      for (var i:String in effects)
      {
        props[effects[i].effect] = effects[i].amount;
      }
      TweenLite.to(container,0,{colorMatrixFilter:props});
    }

    props object could look something like: {contrast:0.5,saturation:1}

  4. First, let me say, I don't think this is a problem with GSAP.

     

    Look at: http://dopserv1.dop.com/test/ (sorry, I only have an MP4 at the moment)

     

    On the image on the right, when you mouse over and click the zoom icon, a larger image appears.

     

    The animation of the slide growing is choppy prior to starting the video. After the video has begun to play, the animation is much smoother. Anyone know the reason for this?

     

    I have tested this in Chrome on windows 7 and safari on OSX, both with the same behavior

  5. I am trying to apply a colorMatrix filter on a text field and it doesn't seem to be working

     

    private function menuOver(e:MouseEvent):void
    {
    TweenLite.to(e.target.txt,0.5,{colorMatrixFilter:{colorize:0xffffff},ease:Expo.easeOut});
    TweenLite.to(e.target.bg,0.5,{colorMatrixFilter:{colorize:0x3299FF},ease:Expo.easeOut});
    }
    

     

    The bg changes color, but the text does not. Any ideas?

  6. I have the latest version of TweenMax and yoyo stopped working for me:

    for (var i:int = 0; i < buttons.length; i++)
    {
    var targ = getChildByName("btn" + i);
    targ.id = i;
    targ.buttonMode = true;
    targ.useHandCursor = true;
    targ.addEventListener(MouseEvent.CLICK, onClick);
    TweenMax.to(targ, 0.5, {alpha:0.3, yoyo:0,ease:Linear.easeNone});
    }
    

     

    any idea why?

×