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 9148459
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:16:44+00:00 2026-06-17T11:16:44+00:00

Check out my html5 based clipping constraint on http://shedlimited.debrucellc.com/test3/canvaskinclip.html (messing with jsfiddle on http://jsfiddle.net/aqaP7/4/

  • 0

Check out my html5 based clipping constraint on

http://shedlimited.debrucellc.com/test3/canvaskinclip.html

(messing with jsfiddle on http://jsfiddle.net/aqaP7/4/)

So, in html5 I can easily draw a shaped boundary like the following:

         context.beginPath();
  context.moveTo(5, 5);
  context.lineTo(34, 202);

  context.lineTo(2, 405);
  context.lineTo(212, 385);
  context.lineTo(425, 405);
  context.lineTo(400, 202);
  context.lineTo(415, 10);
  context.lineTo(212, 25);
                context.clip();

In kinetic.js though, all I see for clipping options is: height, width, and x, y,

I came across the following : Mask/Clip an Image using a Polygon in KineticJS, but the inner/fill image can’t be set to draggable

any help please!

  • 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-17T11:16:45+00:00Added an answer on June 17, 2026 at 11:16 am

    In the new kineticJS versions, a lot of the work is done in the background for you.

    Take a look at this tutorial:

    This fiddle gets you pretty close, here’s the code:

     <body>
        <div id="container"></div>
        <script src="http://www.html5canvastutorials.com/libraries/kinetic-v4.3.0-beta2.js"></script>
        <script>
          function loadImages(sources, callback) {
            var images = {};
            var loadedImages = 0;
            var numImages = 0;
            // get num of sources
            for(var src in sources) {
              numImages++;
            }
            for(var src in sources) {
              images[src] = new Image();
              images[src].onload = function() {
                if(++loadedImages >= numImages) {
                  callback(images);
                }
              };
              images[src].src = sources[src];
            }
          }
          function draw(images) {
            var stage = new Kinetic.Stage({
              container: 'container',
              width: 600,
              height: 700
            });
            var layer = new Kinetic.Layer();
    
            var patternPentagon = new Kinetic.RegularPolygon({
              x: 220,
              y: stage.getHeight() / 4,
              sides: 5,
              radius: 70,
              fillPatternImage: images.yoda,
              fillPatternOffset: [-220, 70],
              stroke: 'black',
              strokeWidth: 4,
              draggable: true
            });
    
    
            patternPentagon.on('dragmove', function() {
            //this.setFillPatternImage(images.yoda);
              //this.setFillPatternOffset(-100, 70);
              var userPos = stage.getUserPosition();
              this.setFillPatternOffset(-userPos.x,-userPos.y);
              layer.draw();
                this.setX(220);
                this.setY(stage.getHeight() / 4);
            });
    
    
            layer.add(patternPentagon);
    
            stage.add(layer);
          }
          var sources = {
            darthVader: 'http://www.html5canvastutorials.com/demos/assets/darth-vader.jpg',
            yoda: 'http://www.html5canvastutorials.com/demos/assets/yoda.jpg'
          };
    
          loadImages(sources, function(images) {
            draw(images);
          });
    
        </script>
      </body>
    

    There is a more complex/accurate way of doing this without making it a background pattern, like with grouping objects together

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

Sidebar

Related Questions

Check out my example here: http://timkjaerlange.com/foobar/test.html I'm currently trying to apply a class to
check out the following test: http://binks.knobbits.org/webgl/texture3.html It's a simple test of cube textures. It
I have made this webpage, you can check it out here http://www.bettingtowin.net/webcam.html I have
Can check out here alt text http://51hired.com/static/problem.bmp
Check out http://fube.ca in any browser but Firefox and you'll see that the cloud
Please check out http://rainsongmanchesters.net/news.htm and notice the black strip above the header image. Now
I cannot manage to get my head around redbacktrees, based on this implementation http://pastebin.com/Gg3YbPUg
Check out this jsbin . I have a form with a custom button that
Check out this demo by FaTaL. It is explained in his blog that he
Check out this piece of JavaScript code: (function (w, d) { var loader =

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.