【问题标题】:change width stage from input从输入改变宽度阶段
【发布时间】:2013-01-19 18:01:10
【问题描述】:

有人可以帮我吗?

我有一个舞台和图像,我想从输入中更改宽度和高度。 这是代码,它不起作用:/帮助我。)

var stage = new Kinetic.Stage({ 容器:'containerCreator', 宽度:图像宽度, 高度:图像高度 });

var layer = new Kinetic.Layer();

var imageObj = new Image();
imageObj.onload = function(){
  var yoda = new Kinetic.Image({
    x: 0,
    y: 0,
    image: imageObj,
    width: imageWidth,
    height: imageHeight
  });



  layer.add(yoda);
  layer.add(vrchnyText);
  stage.add(layer);  

  };
  imageObj.src = imageSource;

  $('#vrchCreator').keyup(function(){

    stage.width = $(this).val();        
    stage.height= $(this).val();    
    layer.add(yoda);
    stage.add(layer);  

});

【问题讨论】:

    标签: kineticjs


    【解决方案1】:

    您想将其更改为:

    $('#vrchCreator').keyup(function()
    { 
       stage.setWidth(parseInt($(this).val()));
       stage.setHeight(parseInt($(this).val()));
       layer.add(yoda);
       stage.add(layer);  
    
    });
    

    【讨论】:

      猜你喜欢
      • 2020-11-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-01-11
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多