How to apply KineticJS filter ?

老子叫甜甜 提交于 2019-12-10 19:28:01

问题


I find the KineticJS filters documentation extremely frustrating and could not find examples online, especially considering brightness.

The kinetic.filters docs link mention a Kinetic.Filters.Brighten(imageData) but there's no info on how to pass parameters to it or how to use it.

All I need is a working example of an image on a layer on a stage, and two buttons - one to make the image brighter and one to make it darker. Can anyone please help me with that ?

Thank you !


回答1:


Realy, documentation for filters is poor.

Example for Brighten filter: (kineticjs 4.5.0)

    darth = new Kinetic.Image({
      x: 10,
      y: 10,
      image: imageObj,
      draggable: true,
      filter: Kinetic.Filters.Brighten,
      filterBrightness: -50
    });

for animate you can use this tutorial: http://www.html5canvastutorials.com/kineticjs/html5-canvas-tween-blur-filter-with-kineticjs/

    var tween = TweenLite.to(darth, 0.6, {
      paused: true,
      setFilterBrightness: 50,
      onUpdate: function() {
        layer.batchDraw(); 
      }
    });


来源:https://stackoverflow.com/questions/16473880/how-to-apply-kineticjs-filter

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!