Pregunta

i want to try processing.js on an iOS application,

i have checked the projects on http://procoding.audiocommander.de/ and http://luckybite.com/iprocessing/

but none of them have an actual working example, so i went to create one...

SO... I have created a project and uploaded in https://github.com/mako34/processing_iOS

my understanding is that all I need is just a wrapper for html5 canvas and js, for the

processing-1.4.1.js

to work??

my index.html works fine in a browser, not on the device!

my canvas works fine drawing a line on this test template

my js works fine on this test template

but doesnt work on the iphone actual web view,

So what is missing to make the sketch work?

thanks a lot!

here my index.html

<!doctype html>
<head>
    <meta charset="utf-8">
      <meta name="viewport" content="width=device-width,initial-scale=1">

      <link rel="stylesheet" href="style.css">

      <script src="jquery-1.6.2.min.js"></script>
      <script defer src="script.js"></script>
      <script src="processing-1.4.1.js"></script>


</head>
<body id="body">
  <div id="container">

    <div id="main" role="main">
        <a href="/" class="js">jQuery Alert</a><br />
        <a href="objc://message">Objective-C Alert</a><br />
        <a href="objc://takePicture">Take a picture</a><br />
    </div><!-- #main -->

      <canvas data-processing-sources="example.pde" style="border: 1px solid black;"></canvas>

    <img id="testImage" src="iphonebattery.jpeg" />

      <canvas id="myCanvas" width="320" height="200"></canvas>
      <script>
          var canvas = document.getElementById('myCanvas');
          var context = canvas.getContext('2d');

          context.beginPath();
          context.moveTo(100, 150);
          context.lineTo(450, 50);
          context.stroke();
          </script>

  </div><!-- #container -->
</body>
</html>
¿Fue útil?

Solución

First off-- you don't want to have two canvas tags. I recommend checking out the actual ProcessingJS website for better implementation: http://processingjs.org/

I have some tutorials on setting up Processing to compile to iOS and preparing your iDevice: http://ericmedine.com/processing-for-ios/

Hope this helps!

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top