Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8513685
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T04:38:44+00:00 2026-06-11T04:38:44+00:00

I recently found this knockoutjs plugin for KineticJS The wiki page includes an example,

  • 0

I recently found this knockoutjs plugin for KineticJS

The wiki page includes an example, but I don’t really understand what it does exactly:

<!DOCTYPE html>
<html>
  <head>
    <title>A Knockout/Kinetic example</title>
    <script type="text/javascript" src="kinetic-v3.9.8.min.js"></script>
    <script type="text/javascript" src="knockout-2.1.0.js"></script>
    <script type="text/javascript" src="../knockout-kinetic.js"></script>
  </head>
  <body>
    <!--
   This example is from the 'Rect' tutorial:
   http://www.html5canvastutorials.com/kineticjs/html5-canvas-kineticjs-rect-tutorial/
   -->
    <div id="container">
      <!-- Look, ma! No JavaScript! -->
      <!-- ko Kinetic.Stage: { width: 578, height: 200 } -->
      <!--     ko Kinetic.Layer: { } -->
      <!--         ko Kinetic.Rect: { x: 239, y: 75, width: 100, height: 50, fill: "#00D2FF", stroke: "black", strokeWidth: 4 } -->
      <!--         /ko -->
      <!--     /ko -->
      <!-- /ko -->
    </div>
    <script type="text/javascript">
        // Ok, a *little* JavaScript...
        ko.applyBindings();
    </script>
</html>

Aside from not getting the “no javascript” joke (at least I think that’s what it is?)
I don’t see how this plugin might help me to bind to a list of knockout observables that defines a number or rectangles.

For example, let’s say I get the following json as a result of an ajax call:

{"rectangles":[{"id":1,"x":0,"y":0,"width":200,"height":30},{"id":2,"x":0,"y":40,"width":200,"height":30}]}

I could then use this data to populate an observable array in my ViewModel
but how do I use the plugin to bind Kinetic to it so that the rectangles
are automatically displayed and updated?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T04:38:51+00:00Added an answer on June 11, 2026 at 4:38 am

    This can be built up in pieces. Given a JavaScript object with your rectangle data, you create your view model:

    var viewModel = ko.observable(data);
    ko.applyBindings(viewModel);
    

    And render it using an HTML file that implements your view:

    <div id="container"> <!-- The container is optional but good practice -->
      <!-- ko Kinetic.Stage: { width: 800, height: 600 } -->
      <!--     ko Kinetic.Layer: { } -->
      <!--         ko foreach: rectangles -->
      <!--             ko Kinetic.Rect: $data -->
      <!--             /ko --> 
      <!--         /ko -->
      <!--     /ko -->
      <!-- /ko -->
    </div>
    

    You always need to declare your Stage, and at least one Layer. You can use knockout bindings to organize your shapes in that one layer, or distribute them among many layers, as is appropriate for your application.

    Once you have it working with JavaScript objects, you can use your JSON data directly by using the knockout mapping plugin:

    var viewModel = ko.mapping.fromJS(data);
    ko.applyBindings(viewModel);
    

    The “no JavaScript” refers to eliminating the need to setup your Kinetic Stage contents using JavaScript calls, replacing it with a declarative definition of your user interface.

    Also, be aware that the syntax is still under development. I haven’t worked with it for a while so change hasn’t happened quickly, but I’d be eager to hear feedback from your experiences.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So, i recently found this term related somehow to neural networks, but I don't
But recently I found this link quite helpful to understand the principles of LSA
I recently found an article online that told me about this: RewriteRule ^mock-up/([^/]+)/([^/]+) /mock-up/index.php?page=$1&section=$2
This question is based off some really odd code I recently found in a
I recently found this web page Crime in Downtown Houston that I'm interested in
The obvious answer is to use Charset.defaultCharset() but we recently found out that this
Found this recently, but can't for the life of me figure out how the
I am using cocos2d-iphone, latest non-beta version. Recently I found this: http://www.cocos2d-iphone.org/wiki/doku.php/prog_guide:effects , and
I recently found this which is great as its the API but it doesn't
I recently found this post . It basically says that Eclipse has a modified

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.